diff options
Diffstat (limited to 'test/behaviour/panes.zig')
| -rw-r--r-- | test/behaviour/panes.zig | 7 |
1 files changed, 7 insertions, 0 deletions
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 |
