summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-03 17:38:40 -0300
committerGabriel Schneider <[email protected]>2026-11-03 17:49:14 -0300
commitf9e538742f149598e26d893732ba249fed6b5e14 (patch)
treeef69eb76452321c635d5a6a5b6e7e6b64e91147e /test
parentccb668645e9afc3710b1a50903022367a800ff1b (diff)
downloadpardes-f9e538742f149598e26d893732ba249fed6b5e14.tar.gz
pardes-f9e538742f149598e26d893732ba249fed6b5e14.zip
test: review of the core migration's tests: the Pet test takes its branch from the build's platform (pardes_config, imported into the behaviour module, its options alone), not from whether Pet was taken, so a terminal's view taking Pet now fails it; New's absence checked in a file pane's tag and a scratch's made by New, not only in 9P's +New twice; the emptied column's tag shown to have the keyboard (typed into); the pane's tag drawn on the row under a one-row column tag; each checked to fail against a break (Pet without in_window, New in the file pane's tag, an emptied column's focus given to the workspace tag)
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge
Diffstat (limited to 'test')
-rw-r--r--test/behaviour/columns_and_tags.zig17
-rw-r--r--test/behaviour/settings.zig6
2 files changed, 19 insertions, 4 deletions
diff --git a/test/behaviour/columns_and_tags.zig b/test/behaviour/columns_and_tags.zig
index 5b78a6c8..a67fa110 100644
--- a/test/behaviour/columns_and_tags.zig
+++ b/test/behaviour/columns_and_tags.zig
@@ -102,6 +102,9 @@ test "columns-and-tags: closing a column's last pane leaves it empty, its tag wi
// Down from it goes nowhere: nothing is below.
try s.write(s.at("/pane/{d}/exec", .{first}), "Down\n");
try s.expect("/focus", "");
+ // The tag with the keyboard is the emptied column's: what is typed lands there.
+ try s.keys("iMine\x1b");
+ try std.testing.expect(std.mem.indexOf(u8, try s.read(s.at("/col/{d}/tag", .{col})), "Mine") != null);
try s.write(s.at("/col/{d}/ctl", .{col}), "Delcol\n");
try expectEqualStrings(s.at("{d}:{d}", .{ left, first }), try s.columns());
try std.testing.expectEqual(first, try s.focused());
@@ -137,11 +140,18 @@ test "columns-and-tags: New is a column tag's word, in no pane's tag nor the wor
defer s.deinit();
var t = try Session.initTerm(std.testing.allocator);
defer t.deinit();
- const scratch = try s.newPane();
+ // The file pane's, read before 9P's new takes the keyboard; a scratch
+ // made by New, and 9P's new (a +New file pane).
+ const file = try s.read(s.at("/pane/{d}/tag", .{try s.focused()}));
+ const made = try s.newPane();
+ try s.write(s.at("/col/{d}/exec", .{try s.column(0)}), "New\n");
+ const scratch = try s.focused();
+ try std.testing.expect(made != scratch);
for ([_][]const u8{
try s.read("/tag"),
+ file,
+ try s.read(s.at("/pane/{d}/tag", .{made})),
try s.read(s.at("/pane/{d}/tag", .{scratch})),
- try s.read(s.at("/pane/{d}/tag", .{try s.focused()})),
try t.read(t.at("/pane/{d}/tag", .{try t.focused()})),
}) |tag| {
var words = std.mem.tokenizeScalar(u8, tag, ' ');
@@ -161,7 +171,8 @@ test "columns-and-tags: a click past a column tag's text types after it, a newli
try s.keys("\nSnarf");
try expectEqualStrings("New Tty Find Grep Joincol Delcol Snarf", try s.read(tag));
try std.testing.expect(std.mem.indexOf(u8, try s.screen(), rows ++ " Snarf ") != null);
- try std.testing.expect(std.mem.indexOf(u8, try s.screen(), "\n /test.txt Save") != null);
+ // The pane's tag on the row right under it: the column's is one row.
+ try std.testing.expectEqual((try s.where(rows))[1] + 1, (try s.where("/test.txt Save"))[1]);
// Wider than the screen: the tag scrolls to keep its caret drawn.
try s.keys(" 界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界");
const col, const row = (try s.cursor()).?;
diff --git a/test/behaviour/settings.zig b/test/behaviour/settings.zig
index 59e6f7c3..e62539e4 100644
--- a/test/behaviour/settings.zig
+++ b/test/behaviour/settings.zig
@@ -5,7 +5,10 @@ const Session = @import("session").Session;
test "settings: Pet is the window's: a terminal's view refuses it, from a pane and the root; a window takes only its pets" {
var s = try Session.initFile(std.testing.allocator, "x\n");
defer s.deinit();
- if (try s.refused("/ctl", "Pet cat\n") == 0) {
+ // Which build, from its options, not from the answer: a terminal's view
+ // taking Pet must fail here, not pass as a window.
+ if (comptime @import("pardes_config").platform == .gui) {
+ try s.write("/ctl", "Pet cat\n");
// A window's: dog is no pet of its, and off is.
try std.testing.expect(std.mem.indexOf(u8, try s.read("/ctl"), "\nPet cat\n") != null);
_ = try s.refused("/ctl", "Pet dog\n");
@@ -16,6 +19,7 @@ test "settings: Pet is the window's: a terminal's view refuses it, from a pane a
try std.testing.expect(std.mem.indexOf(u8, try s.read("/ctl"), "\nPet off\n") != null);
return;
}
+ try std.testing.expectEqual(@as(u16, 22), try s.refused("/ctl", "Pet cat\n"));
try std.testing.expect(std.mem.startsWith(u8, s.said, "Pet is GUI-only, invalid here"));
try std.testing.expectEqual(@as(u16, 22), try s.refused(s.at("/pane/{d}/exec", .{try s.focused()}), "Pet cat\n"));
try std.testing.expectEqualStrings("Pet is GUI-only, invalid here", s.said);