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.zig17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/ninep/ctl.zig b/src/ninep/ctl.zig
index 2fdc47cc..caa3f009 100644
--- a/src/ninep/ctl.zig
+++ b/src/ninep/ctl.zig
@@ -980,6 +980,23 @@ test "a look takes acme's :addr and file:addr, and a miss changes nothing" {
try testing.expectStringStartsWith(p.panes[0].?.msg[0..p.panes[0].?.msg_len], "Look: ");
}
+test "the root look's file:/re/ goes on from the dot, and a miss leaves the dot as it was" {
+ const gpa = testing.allocator;
+ const p = try withFile(gpa, "foo x foo y\nfoo\n");
+ defer p.deinit();
+ const dot = Node.of(serialOf(p), .dot);
+ const root = @intFromEnum(tree.TopFile.look);
+ var line: [256]u8 = undefined;
+ const path = p.panes[0].?.file.?.path;
+ const again = try std.fmt.bufPrint(&line, "{s}:/foo/\n", .{path});
+ for ([_][]const u8{ " 0 3 ", " 6 9 ", " 12 15 ", " 0 3 " }) |want| {
+ try testing.expectEqual(Status.ok, wr(p, root, again).reply.status);
+ try testing.expectEqualStrings(want, rd(p, dot, 0, 64).bytes);
+ }
+ try testing.expectEqual(Status.ok, wr(p, root, try std.fmt.bufPrint(&line, "{s}:/zzqq/\n", .{path})).reply.status);
+ try testing.expectEqualStrings(" 0 3 ", rd(p, dot, 0, 64).bytes);
+}
+
test "exec runs a builtin at the pane and records the pane it acted on" {
const gpa = testing.allocator;
const p = try withFile(gpa, "Msg fs-ran\n");