From 0f632dbd1069d9654d587ebac8e29955a9a31188 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Tue, 29 Sep 2026 16:45:37 -0300 Subject: A look that misses file:/re/ names the file and is logged as that file's pane's A miss said only look: no match for regexp, against the pane the look came from. It now says look: : no match for regexp, on the pane of the file it searched. Co-Authored-By: Claude Opus 5.5 --- src/ninep/ctl.zig | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'src/ninep') 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:
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")); -- cgit v1.3