diff options
| author | Gabriel Schneider <[email protected]> | 2026-07-01 19:56:21 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-08-01 15:02:07 -0300 |
| commit | cc806b11ba880d1bd326e3f1f9e69f7539c22395 (patch) | |
| tree | 3b200ed4e46e2c80d2762ae2efd45bf87413133d /tests.zig | |
| parent | f3618a5a3151e02db2c1e2280ab42d48c35eeba9 (diff) | |
| download | pardes-cc806b11ba880d1bd326e3f1f9e69f7539c22395.tar.gz pardes-cc806b11ba880d1bd326e3f1f9e69f7539c22395.zip | |
more treesitter grammars
Diffstat (limited to 'tests.zig')
| -rw-r--r-- | tests.zig | 50 |
1 files changed, 50 insertions, 0 deletions
@@ -38,6 +38,7 @@ fn colOf(text: []const u8, needle: []const u8) ?usize { pub fn main(init: std.process.Init) !void { const gpa = init.gpa; + const io = init.io; const args = try init.minimal.args.toSlice(init.arena.allocator()); if (args.len != 2) { std.debug.print("usage: {s} <pardes-exe>\n", .{args[0]}); @@ -299,6 +300,8 @@ pub fn main(init: std.process.Init) !void { try hs.pump(800); // build the run 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"); + try hs.expectContains("Save Del", "file pane tag did not include the default Save command"); + try hs.expectNotContains("Delcol", "Delcol is still shown in the default pane tag"); // 9. Modal modes on the active FILE pane (left open & focused by step 8): // `i` -> INSERT (tag shows "in"), Esc -> NORMAL ("nm"). Validates the @@ -359,6 +362,25 @@ pub fn main(init: std.process.Init) !void { try hs.pump(800); try hs.expectNotContains("ZZVSELMARK", "U (redo) did not re-apply the delete"); + // 10c. Save writes the current file pane back to disk. Add a durable marker, + // middle-click the default "Save" command in the file tag, then read the + // real file from /tmp and confirm the edit landed there. + try hs.send("o"); // open a new line below -> insert + try hs.pump(500); + try hs.send("ZZSAVEDISK"); + try hs.pump(500); + try hs.send("\x1b"); // -> normal + try hs.pump(500); + try hs.expectContains("ZZSAVEDISK", "save setup: marker not visible in the file pane"); + try hs.send("\x1b[<1;31;2M\x1b[<1;31;2m"); // middle-click "Save" in the file tag + try hs.pump(1000); + const saved = try std.Io.Dir.cwd().readFileAlloc(io, "/tmp/pardesE2Efile.txt", gpa, .limited(1 << 20)); + defer gpa.free(saved); + if (std.mem.indexOf(u8, saved, "ZZSAVEDISK") == null) { + hs.dump("Save command did not write the edited file content to disk"); + return error.SaveDidNotWriteDisk; + } + // 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 @@ -382,6 +404,34 @@ pub fn main(init: std.process.Init) !void { try hs2.expectWaitFor("ZZTTYFLAG", 8000, "--tty single shell did not forward input to the shell"); } + // 12b. -h/--help print usage and exit before entering the TUI. + { + var hsh = try Harness.initArgs(gpa, exe.ptr, 12, 80, "-h"); + defer hsh.deinit(); + try hsh.expectWaitFor("Usage: pardes", 4000, "-h did not print usage"); + try hsh.expectContains("--tty-toggle", "-h help did not mention --tty-toggle"); + } + { + var hsh2 = try Harness.initArgs(gpa, exe.ptr, 12, 80, "--help"); + defer hsh2.deinit(); + try hsh2.expectWaitFor("Usage: pardes", 4000, "--help did not print usage"); + } + + // 12c. The tty toggle can be moved off Ctrl-b. With --tty-toggle=g, Ctrl-b + // should no longer enter tty; Ctrl-g should. + { + var hsg = try Harness.initArgs(gpa, exe.ptr, 24, 80, "--tty-toggle=g"); + defer hsg.deinit(); + try hsg.expectWaitFor("nm /", 6000, "--tty-toggle=g app did not start in normal mode"); + try hsg.send("\x02"); // Ctrl-b: now just a normal-mode key, not the tty toggle + try hsg.pump(600); + try hsg.expectNotContains("sy /", "Ctrl-b still toggled tty after --tty-toggle=g"); + try hsg.send("\x07"); // Ctrl-g: configured tty toggle + try hsg.expectWaitFor("sy /", 6000, "Ctrl-g did not toggle tty after --tty-toggle=g"); + try hsg.send("\x07"); + try hsg.expectWaitFor("nm /", 6000, "Ctrl-g did not toggle tty back to normal"); + } + // 13. Terminal char-mode editing end to end (fresh instance for a clean pane): // insert an overlay run, backspace part of it, Ctrl-b to tty (overlay hidden) // and back (overlay returns), then u (undo the whole insert) / U (redo). |
