diff options
Diffstat (limited to 'tests.zig')
| -rw-r--r-- | tests.zig | 53 |
1 files changed, 35 insertions, 18 deletions
@@ -39,6 +39,13 @@ pub fn main(init: std.process.Init) !void { hs.trace = config.trace; defer hs.deinit(); + // 0. The stats overlay is off by default; turn it on via the "Debug" command in + // the global tagbar (top row). "Debug" sits at cols 18-22, so SGR col ~20, + // row 1. This also exercises the global tagbar + the Debug toggle. Give the + // app a moment to come up and render the bar first. + try hs.pump(800); + try hs.send("\x1b[<1;20;1M\x1b[<1;20;1m"); // toggle the Debug overlay on + // 1. The app posts an initial winsize on startup. Its winsize handler bumps // the resize counter to 1 and repaints, so "resizes=1" shows in the debug // overlay. Confirms the app is up and handled its first size. @@ -65,7 +72,7 @@ pub fn main(init: std.process.Init) !void { try hs.pump(600); try hs.send("printf '#!/bin/sh\\necho ZZTABRAN\\n' > /tmp/zztabcmd; chmod +x /tmp/zztabcmd; clear; echo /tmp/zztabcmd\r"); try hs.pump(1200); - try hs.send("\x1b[<0;8;2M\x1b[<0;8;2m"); // left-click the path on body row 0 -> normal + pin + try hs.send("\x1b[<0;8;3M\x1b[<0;8;3m"); // left-click the path on body row 0 -> normal + pin (+1 row: global tagbar) try hs.pump(600); try hs.send("\t"); // TAB: execute "/tmp/zztabcmd" try hs.expectWaitFor("ZZTABRAN", 8000, "normal-mode Tab did not execute the word under the cursor"); @@ -85,7 +92,7 @@ pub fn main(init: std.process.Init) !void { try hs.pump(900); try hs.send("\x02"); // tty -> normal try hs.pump(400); - try hs.send("\x1b[<0;5;10M\x1b[<0;5;10m"); // left-click a low blank row (screen row 9) -> normal + pin + try hs.send("\x1b[<0;5;11M\x1b[<0;5;11m"); // left-click a low blank row -> normal + pin (+1 row: global tagbar) try hs.pump(400); try hs.send("i"); // insert try hs.pump(400); @@ -93,7 +100,7 @@ pub fn main(init: std.process.Init) !void { try hs.pump(600); try hs.send("\x1b"); // -> normal try hs.pump(400); - try hs.send("\x1b[<1;5;10M\x1b[<33;21;10M\x1b[<1;21;10m"); // middle-drag-select the line -> run (padded) + try hs.send("\x1b[<1;5;11M\x1b[<33;21;11M\x1b[<1;21;11m"); // middle-drag-select the line -> run (padded) try hs.expectWaitFor("PAD13Z", 8000, "padded command did not run"); try hs.pump(600); { @@ -149,7 +156,7 @@ pub fn main(init: std.process.Init) !void { try hs.send("echo CMDHIDEZZ\r"); try hs.expectWaitFor("CMDHIDEZZ", 8000, "tty mode did not run the command"); try hs.pump(800); // let tty-mode frames settle - try hs.send("\x1b[<0;6;3M\x1b[<0;6;3m"); // left-click body -> normal (prompts now hidden) + try hs.send("\x1b[<0;6;4M\x1b[<0;6;4m"); // left-click body -> normal (prompts now hidden) (+1 row: global tagbar) try hs.pump(600); try hs.expectContains("CMDHIDEZZ", "command output not shown in normal mode"); // The prompt row (with the typed command) is hidden in normal mode now too. We @@ -161,13 +168,13 @@ pub fn main(init: std.process.Init) !void { // cursor at text col 0, type a computed echo, then middle-select those 15 // cells and release. "Q7Z" appears only if the SELECTED typed text ran — // proving selection reads the rendered screen. - try hs.send("\x1b[<0;3;14M\x1b[<0;3;14m"); // click blank row 13, col 0 -> normal + pin + try hs.send("\x1b[<0;3;15M\x1b[<0;3;15m"); // click blank row, col 0 -> normal + pin (+1 row: global tagbar) try hs.pump(400); try hs.send("i"); // normal -> insert so typing composes the command try hs.pump(400); try hs.send("echo Q$((3+4))Z"); try hs.pump(600); // let the run build - try hs.send("\x1b[<1;3;14M\x1b[<33;17;14M\x1b[<1;17;14m"); // middle-select it + try hs.send("\x1b[<1;3;15M\x1b[<33;17;15M\x1b[<1;17;15m"); // middle-select it (+1 row: global tagbar) try hs.expectWaitFor("Q7Z", 8000, "middle-click did not execute the selected typed text"); // leave insert -> normal so the next step can reach tty via Ctrl-b try hs.send("\x1b"); @@ -184,7 +191,7 @@ pub fn main(init: std.process.Init) !void { try hs.pump(500); { var w: usize = 0; - while (w < 30) : (w += 1) try hs.send("\x1b[<64;5;5M"); // wheel UP over the pane + while (w < 30) : (w += 1) try hs.send("\x1b[<64;5;6M"); // wheel UP over the pane (+1 row: global tagbar) } try hs.pump(500); try hs.expectNotContains("LN40", "wheel-up did not scroll the pane off the bottom"); @@ -202,7 +209,7 @@ pub fn main(init: std.process.Init) !void { try hs.pump(700); try hs.send("rm -rf /tmp/pardesE2E; mkdir -p /tmp/pardesE2E/ZZUNIQDIR; clear; echo /tmp/pardesE2E\r"); try hs.pump(2000); // let it run + settle - try hs.send("\x1b[<2;5;2M\x1b[<2;5;2m"); // right-click the path on screen row 1 + try hs.send("\x1b[<2;5;3M\x1b[<2;5;3m"); // right-click the path (+1 row: global tagbar) try hs.expectWaitFor("ZZUNIQDIR", 12000, "right-click on a directory did not open+ls it"); // 8. Right-click a "path:line" opens a line-numbered FILE pane SCROLLED to @@ -220,13 +227,13 @@ pub fn main(init: std.process.Init) !void { } try hs.resize(30, 100); // clean geometry (right column starts ~col 51) try hs.pump(700); // settle the reflow - try hs.send("\x1b[<0;60;11M\x1b[<0;60;11m"); // left-click blank row, right column -> normal + pin + try hs.send("\x1b[<0;60;19M\x1b[<0;60;19m"); // left-click a blank row well below the ls output, right column -> normal + pin (+1 row: global tagbar) try hs.pump(400); try hs.send("i"); // normal -> insert so typing composes the path:line try hs.pump(400); try hs.send("/tmp/pardesE2Efile.txt:150"); try hs.pump(800); // build the run - try hs.send("\x1b[<2;70;11M\x1b[<2;70;11m"); // right-click on the typed path + try hs.send("\x1b[<2;70;19M\x1b[<2;70;19m"); // right-click on the typed path (+1 row: global tagbar) try hs.expectWaitFor("ZZDEEPMARK", 12000, "right-click 'path:150' did not open the file scrolled to line 150"); // 9. Modal modes on the active FILE pane (left open & focused by step 8): @@ -260,16 +267,26 @@ pub fn main(init: std.process.Init) !void { // sanity: the deep marker (line 150, above the opened/deleted line) survives. try hs.expectContains("ZZDEEPMARK", "ZZDEEPMARK vanished — file pane content was clobbered"); - // 11. The Tutor builtin: middle-clicking "Tutor" in any tag spawns the tutor - // text as a new file pane. The tutor is embedded in the binary - // (@embedFile), so its content (the PARDES TUTOR header + the acme mouse - // intro) appears on screen. Middle-click is button 1 (SGR: <1;...M). - // Tag row 0 is the first row of any pane; "Tutor" sits at the end of the - // tag. Click somewhere in the tag's right half to hit it. - try hs.send("\x1b[<1;48;1M\x1b[<1;48;1m"); // middle-click "Tutor" in the tag row (file pane's "nm " prefix shifts it +3) - try hs.expectWaitFor("PARDES TUTOR", 10000, "middle-click 'Tutor' did not spawn the tutor pane"); + // 11. The Tutor builtin now lives in the GLOBAL tagbar (top row, full width): + // "Kill Newcol Tutor Debug". Clicking "Tutor" there spawns the tutor as a + // file pane. The tutor is embedded in the binary (@embedFile), so its + // content (the PARDES TUTOR header + the acme mouse intro) appears. "Tutor" + // sits at cols 12-16 (0-based) -> SGR col ~14, the tagbar is screen row 1. + try hs.send("\x1b[<1;14;1M\x1b[<1;14;1m"); // middle-click "Tutor" in the global tagbar + try hs.expectWaitFor("PARDES TUTOR", 10000, "global-tagbar 'Tutor' did not spawn the tutor pane"); try hs.expectContains("tmux + vi + acme", "tutor pane content is wrong (no tagline)"); // Tell the app to quit (ctrl-c is the app's own exit key). try hs.send("\x03"); + + // 12. The --tty flag: start tmux-style as a single shell pane already in tty + // mode. Confirm the (only) pane's tag shows "sy" (tty) and that keystrokes + // go straight to the shell. A fresh app instance with the flag. + { + var hs2 = try Harness.initArgs(gpa, exe.ptr, 24, 80, "--tty"); + defer hs2.deinit(); + try hs2.expectWaitFor("sy /", 6000, "--tty did not start in tty mode (no 'sy' tag)"); + try hs2.send("echo ZZTTYFLAG\r"); + try hs2.expectWaitFor("ZZTTYFLAG", 8000, "--tty single shell did not forward input to the shell"); + } } |
