summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-03 17:38:42 -0300
committerGabriel Schneider <[email protected]>2026-11-03 17:40:39 -0300
commit2e4868beb25eb81f7b21a9ad481b5b121c65c4c8 (patch)
tree14fcff5b1232de8e51d6f643206862dd1eca7aae
parent289d0f1e5d46bea014dbcfe671d84ac09bebe247 (diff)
downloadpardes-2e4868beb25eb81f7b21a9ad481b5b121c65c4c8.tar.gz
pardes-2e4868beb25eb81f7b21a9ad481b5b121c65c4c8.zip
test: what the review of the ninep migration found the moved tests no longer checked, back through the 9P tree: a stat of /focus, /ctl and /exec says the length a read gives (0 for an empty /focus), an omode-0 open of a pane's ctl cannot lock, and a look at a line past the end logs that it has no such line; each checked to fail against a break (/focus, /ctl and /exec stat 0, a read-only open's lock taken, the past-end line's words changed)
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge
-rw-r--r--test/behaviour/look_and_exec.zig2
-rw-r--r--test/behaviour/panes.zig7
-rw-r--r--test/behaviour/root_ctl.zig1
3 files changed, 10 insertions, 0 deletions
diff --git a/test/behaviour/look_and_exec.zig b/test/behaviour/look_and_exec.zig
index f3b94a3f..72052f7d 100644
--- a/test/behaviour/look_and_exec.zig
+++ b/test/behaviour/look_and_exec.zig
@@ -92,6 +92,7 @@ test "look-and-exec: a look takes acme's :addr and file:addr, and a miss changes
try s.write(look, s.at("{s}:99\n", .{path}));
try expectEqual(.{ @as(u32, 12), @as(u32, 16) }, try s.range(dot));
try s.expect(look, "");
+ try std.testing.expect(has(try s.read("/log"), s.at("look: {s}:99 has no line 99\n", .{path})));
}
test "look-and-exec: the root look's file:/re/ goes on from the dot, and a miss leaves the dot as it was" {
@@ -116,6 +117,7 @@ test "look-and-exec: exec runs a builtin at the pane, and look and exec read bac
try s.write(s.at("/pane/{d}/exec", .{n}), "Msg from exec\n");
try std.testing.expect(has(try s.read("/log"), s.at("msg {d} from exec\n", .{n})));
try s.expect("/exec", own);
+ try std.testing.expectEqual(@as(u64, own.len), (try s.stat("/exec")).size);
try s.expect(s.at("/pane/{d}/look", .{n}), own);
try s.write(s.at("/pane/{d}/exec", .{n}), "New\n");
const made = try s.focused();
diff --git a/test/behaviour/panes.zig b/test/behaviour/panes.zig
index 9aa28c6a..4ea41693 100644
--- a/test/behaviour/panes.zig
+++ b/test/behaviour/panes.zig
@@ -60,10 +60,13 @@ test "panes: focus reads the pane with the keyboard, and a serial written to it
const first = try s.focused();
const second = try s.newPane();
try s.expect("/focus", s.at("{d}\n", .{second}));
+ // A stat says the length a read gives.
+ try std.testing.expectEqual(@as(u64, s.at("{d}\n", .{second}).len), (try s.stat("/focus")).size);
try std.testing.expect(has(try s.read(s.at("/pane/{d}/ctl", .{first})), " notcurrent "));
// A column's tag has the keyboard: no pane does, and a write takes it back.
try s.write("/ctl", "Newcol\n");
try s.expect("/focus", "");
+ try std.testing.expectEqual(@as(u64, 0), (try s.stat("/focus")).size);
try std.testing.expect(has(try s.read(s.at("/pane/{d}/ctl", .{second})), " notcurrent "));
try s.write("/focus", s.at("{d}\n", .{first}));
try s.expect("/focus", s.at("{d}\n", .{first}));
@@ -123,6 +126,10 @@ test "panes: a second lock is refused until the holder unlocks or closes, and bi
const ctl = s.at("/pane/{d}/ctl", .{n});
const a = try s.hold(ctl, 2);
const b = try s.hold(ctl, 1);
+ // An open that only reads the status line holds nothing to lock with.
+ const reader = try s.hold(ctl, 0);
+ try std.testing.expect(try s.writeFid(reader, "lock\n") != 0);
+ s.clunk(reader);
try std.testing.expectEqual(@as(u16, 0), try s.writeFid(a, "lock\n"));
try std.testing.expectEqual(@as(u16, 0), try s.writeFid(a, "lock\n"));
// Another open's lock is refused at once, and so is its unlock; writes
diff --git a/test/behaviour/root_ctl.zig b/test/behaviour/root_ctl.zig
index f7ebbbb9..90838d90 100644
--- a/test/behaviour/root_ctl.zig
+++ b/test/behaviour/root_ctl.zig
@@ -42,6 +42,7 @@ test "root-ctl: the root ctl reads the settings as a write takes them, and takes
var s = try Session.initFile(std.testing.allocator, "x\n");
defer s.deinit();
const settings = try s.read("/ctl");
+ try std.testing.expectEqual(@as(u64, settings.len), (try s.stat("/ctl")).size);
try std.testing.expect(has(settings, "Verbose on\n"));
try std.testing.expect(has(settings, "LocationsConfig "));
try std.testing.expect(has(settings, "CallstackDepth 8\n"));