summaryrefslogtreecommitdiff
path: root/src/ninep
diff options
context:
space:
mode:
Diffstat (limited to 'src/ninep')
-rw-r--r--src/ninep/ctl.zig19
1 files changed, 18 insertions, 1 deletions
diff --git a/src/ninep/ctl.zig b/src/ninep/ctl.zig
index 1ac53bb7..d2ff4dab 100644
--- a/src/ninep/ctl.zig
+++ b/src/ninep/ctl.zig
@@ -2252,6 +2252,23 @@ test "Mini with no argument is wrong #args, EINVAL, as every word that needs one
try testing.expectEqualStrings("wrong #args in control message \"Mini\"", r.reply.ename);
}
+test "a look that misses file:/re/ names the file, and is logged as its pane's" {
+ const p = try withFile(testing.allocator, "x\n");
+ defer p.deinit();
+ var tmp = testing.tmpDir(.{});
+ defer tmp.cleanup();
+ try tmp.dir.writeFile(testing.io, .{ .sub_path = "f.txt", .data = "alpha\n" });
+ var dir_buf: [4096]u8 = undefined;
+ const dir = dir_buf[0..try tmp.dir.realPath(testing.io, &dir_buf)];
+ var line: [4200]u8 = undefined;
+ _ = wr(p, root_look, try std.fmt.bufPrint(&line, "{s}/f.txt\n", .{dir}));
+ p.sync();
+ const f_serial = p.panes[p.active].?.serial;
+ _ = wr(p, Node.of(serialOf(p), .look), try std.fmt.bufPrint(&line, "{s}/f.txt:/zzqq/\n", .{dir}));
+ var want: [4300]u8 = undefined;
+ try testing.expect(th.logHas(p, try std.fmt.bufPrint(&want, "err {d} look: {s}/f.txt: no match for regexp", .{ f_serial, dir })));
+}
+
test "every EINVAL a write gets says why, in its err record too; DEL is a control character in a line" {
const p = try withFile(testing.allocator, "x\n");
defer p.deinit();
@@ -2978,7 +2995,7 @@ test "@p<serial>:<address> takes any sam address; a miss and an unknown serial a
}
var line: [64]u8 = undefined;
_ = wr(p, root, try std.fmt.bufPrint(&line, "@p{d}:/zzqq/\n", .{serial}));
- try testing.expect(th.logHas(p, "look: no match for regexp"));
+ try testing.expect(th.logHas(p, ": no match for regexp"));
try testing.expectEqualStrings("", rd(p, root, 0, 64).bytes);
_ = wr(p, root, "@p999:/foo/\n");
try testing.expect(th.logHas(p, "look: no pane @p999"));