parity

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 25, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package parity provides the test harness for TUI byte-level and visible-state parity against upstream pi-tui.

Two test styles:

  1. Headless byte parity (`AssertByteParity`): runs a renderer function against an in-process Grid, captures the output stream, and asserts the resulting grid state matches a golden file. Used for fast unit-level parity checks of individual components.

  2. Live tmux parity (`AssertLiveParity`): drives both `~/.local/bin/pig` and the installed upstream pi binary through a tmux scenario, captures panes, and asserts the visible state matches.

TUI parity is enforced by parity/scenarios/*.tmux scenarios.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssertByteParity

func AssertByteParity(t *testing.T, rows, cols int, pigRender, upstreamRender func(*bytes.Buffer))

AssertByteParity runs `pigRender` and `upstreamRender` into independent grids and asserts the resulting visible state is identical line-for-line. Both functions receive a fresh buffer they should write their full render output into.

On failure, prints a side-by-side diff. Style differences are NOT compared here (rendering colour is a separate axis verified by AssertStyleParity).

func AssertGolden

func AssertGolden(t *testing.T, name string, rows, cols int, render func(*bytes.Buffer))

AssertGolden compares the visible state of `render` against a golden file in testdata/<name>.txt. Update goldens via UPDATE_GOLDEN=1.

func Capture

func Capture(rows, cols int, render func(w *bytes.Buffer)) (*termsim.Grid, []byte)

Capture runs render into an in-process Grid of the given dimensions and returns the final grid plus the raw byte stream.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL