summaryrefslogtreecommitdiff
path: root/src/ninep/ctl.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/ninep/ctl.zig')
-rw-r--r--src/ninep/ctl.zig19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/ninep/ctl.zig b/src/ninep/ctl.zig
index cdb6092a..fd3418a1 100644
--- a/src/ninep/ctl.zig
+++ b/src/ninep/ctl.zig
@@ -1823,6 +1823,25 @@ test "Pager is a setting of the root ctl: pardes by default, off taken, anything
try testing.expectEqualStrings("bad value in control message; takes pardes, off \"Pager\"", wr(p, root_ctl, "Pager less\n").reply.ename);
}
+test "a bare :N or :N:M look addresses the pane itself, from its look, the root's and event write-back" {
+ const p = try withFile(testing.allocator, "alpha\nbeta\ngamma\n");
+ defer p.deinit();
+ const serial = serialOf(p);
+ const pane = p.panes[p.paneBySerial(serial).?].?;
+ try testing.expectEqual(Status.ok, wr(p, Node.of(serial, .look), ":2\n").reply.status);
+ try testing.expectEqual(pane_files.State.Range{ .q0 = 6, .q1 = 11 }, pane_files.dotOf(pane));
+ try testing.expectEqual(Status.ok, wr(p, root_look, ":3\n").reply.status);
+ try testing.expectEqual(pane_files.State.Range{ .q0 = 11, .q1 = 17 }, pane_files.dotOf(pane));
+ try testing.expectEqual(Status.ok, wr(p, Node.of(serial, .look), ":3:2\n").reply.status);
+ try testing.expectEqual(@as(u32, 12), pane_files.dotOf(pane).q0);
+ // Written back by an event reader, the same.
+ const event = Node.of(serial, .event);
+ const h = call(p, .{ .tag = 1, .op = .open, .node = event }).reply.handle;
+ defer _ = call(p, .{ .tag = 9, .op = .release, .node = event, .handle = h });
+ try testing.expectEqual(Status.ok, wr(p, event, "ML0 0 0 2 :1\n").reply.status);
+ try testing.expectEqual(pane_files.State.Range{ .q0 = 0, .q1 = 6 }, pane_files.dotOf(pane));
+}
+
test "a refused Del written back through event fails that write, EIO, with its err" {
const gpa = testing.allocator;
const p = try withFile(gpa, "text\n");