summaryrefslogtreecommitdiff
path: root/src/ninep/ctl.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-09-29 16:45:37 -0300
committerGabriel Schneider <[email protected]>2026-10-01 00:12:16 -0300
commit0f632dbd1069d9654d587ebac8e29955a9a31188 (patch)
tree6e858c3a3c71aa6ed651759024e137f703873743 /src/ninep/ctl.zig
parenta59e1ebfdd9f59102de98549eacddd7ca5d3ee84 (diff)
downloadpardes-0f632dbd1069d9654d587ebac8e29955a9a31188.tar.gz
pardes-0f632dbd1069d9654d587ebac8e29955a9a31188.zip
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: <file>: no match for regexp, on the pane of the file it searched. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src/ninep/ctl.zig')
-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"));