summaryrefslogtreecommitdiff
path: root/tests.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-06-29 22:33:21 -0300
committerGabriel Schneider <[email protected]>2026-06-30 08:52:01 -0300
commitb5b526f465924324e2cd4424f5bacc43e50b7673 (patch)
tree2eef9096996d0b7444f073edd8db8ac508efec20 /tests.zig
parent4d5302edfefea0206ca96726f2fcc254ee228ad3 (diff)
downloadpardes-b5b526f465924324e2cd4424f5bacc43e50b7673.tar.gz
pardes-b5b526f465924324e2cd4424f5bacc43e50b7673.zip
vibe file panes now
Diffstat (limited to 'tests.zig')
-rw-r--r--tests.zig35
1 files changed, 35 insertions, 0 deletions
diff --git a/tests.zig b/tests.zig
index eeb397fa..d9cc763b 100644
--- a/tests.zig
+++ b/tests.zig
@@ -26,6 +26,15 @@ fn writeAll(fd: c_int, bytes: []const u8) !void {
}
}
+fn writeFileE2E(path: [*:0]const u8, data: []const u8) !void {
+ const rc = linux.open(path, .{ .ACCMODE = .WRONLY, .CREAT = true, .TRUNC = true }, 0o644);
+ const sfd: isize = @bitCast(rc);
+ if (sfd < 0) return error.OpenFailed;
+ const fd: c_int = @intCast(sfd);
+ defer _ = linux.close(fd);
+ try writeAll(fd, data);
+}
+
// TIOCSWINSZ on the pty master: changes the size and makes the kernel raise
// SIGWINCH in the slave's foreground process group (i.e. the app under test).
fn setWinsize(fd: c_int, rows: u16, cols: u16) !void {
@@ -218,6 +227,32 @@ pub fn main(init: std.process.Init) !void {
return error.RightClickDirFailed;
}
+ // 8. Right-click a "path:line" opens a line-numbered FILE pane SCROLLED to
+ // that line. Build a tall file whose deep marker (line 150) is only
+ // reachable by scrolling, type the path:line on a blank row of the right
+ // column, then right-click it. Typed text renders starting at the click
+ // column, so the right-click lands on the path without knowing any pane
+ // geometry. The file pane opens, scrolls to line 150 -> the marker shows.
+ var fbuf: std.ArrayList(u8) = .empty;
+ defer fbuf.deinit(gpa);
+ {
+ var ln: usize = 1;
+ while (ln <= 200) : (ln += 1)
+ try fbuf.appendSlice(gpa, if (ln == 150) "ZZDEEPMARK\n" else "filler\n");
+ }
+ try writeFileE2E("/tmp/pardesE2Efile.txt", fbuf.items);
+ try setWinsize(master, 50, 200); // clean, known geometry (col 149 is in the right column)
+ try drainFor(gpa, master, &output, 700); // settle the reflow
+ output.clearRetainingCapacity();
+ try writeAll(master, "\x1b[<0;150;11M\x1b[<0;150;11m"); // left-click blank row, right column -> text mode + pin
+ try writeAll(master, "/tmp/pardesE2Efile.txt:150"); // type the path:line (char mode)
+ _ = try pollFor(gpa, master, &output, "ZZNEVERZZ", 8); // settle (build the run)
+ try writeAll(master, "\x1b[<2;156;11M\x1b[<2;156;11m"); // right-click on the typed path
+ if (!try pollFor(gpa, master, &output, "ZZDEEPMARK", 120)) {
+ dump(output.items, "right-click 'path:150' did not open the file scrolled to line 150");
+ return error.RightClickFileFailed;
+ }
+
// Tell the app to quit (ctrl-c is the app's own exit key).
try writeAll(master, "\x03");
}