summaryrefslogtreecommitdiff
path: root/src/ninep/testing.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-09-29 18:13:43 -0300
committerGabriel Schneider <[email protected]>2026-10-01 00:12:17 -0300
commit09ef40318a3a3d1b9494e2a5fa41f71363929676 (patch)
tree2f01fa0ff91e1f9341b90f41acd03b72c2604da1 /src/ninep/testing.zig
parent01bf4ed09423b3c7e01598ff3a844cc3c12c3ff2 (diff)
downloadpardes-09ef40318a3a3d1b9494e2a5fa41f71363929676.tar.gz
pardes-09ef40318a3a3d1b9494e2a5fa41f71363929676.zip
One look logs one err: a file:addr whose file is not there is one miss quoting what was written, and a refused placement is the look's only failure
A look at utf8txt:#3 from a terminal searched for utf8txt, missed, then found the terminal no text to address: two errs for one write. It is now looked for whole, as zzq:2 already was, so every form's miss reads no match for "<as written>". A look whose new pane was refused a place went on to settle its line in the pane it stayed on and logged has no line N after the placement failure; it now stops there. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src/ninep/testing.zig')
-rw-r--r--src/ninep/testing.zig7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/ninep/testing.zig b/src/ninep/testing.zig
index 927552e2..b8eaa02b 100644
--- a/src/ninep/testing.zig
+++ b/src/ninep/testing.zig
@@ -58,11 +58,16 @@ pub fn rd(p: *Pardes, node: u64, off: u64, size: u32) Answer {
/// Whether the log, read whole from a fresh open, holds `needle`.
pub fn logHas(p: *Pardes, needle: []const u8) bool {
+ return logCount(p, needle) > 0;
+}
+
+/// How many times the log, read whole from a fresh open, holds `needle`.
+pub fn logCount(p: *Pardes, needle: []const u8) usize {
const log = @intFromEnum(tree.TopFile.log);
const h = call(p, .{ .tag = 1, .op = .open, .node = log }).reply.handle;
defer _ = call(p, .{ .tag = 3, .op = .release, .node = log, .handle = h });
const text = call(p, .{ .tag = 2, .op = .read, .node = log, .handle = h, .size = 1 << 16 }).bytes;
- return std.mem.indexOf(u8, text, needle) != null;
+ return std.mem.count(u8, text, needle);
}
pub fn wr(p: *Pardes, node: u64, data: []const u8) Answer {