summaryrefslogtreecommitdiff
path: root/src/ninep/ctl.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-09-29 09:57:16 -0300
committerGabriel Schneider <[email protected]>2026-10-01 00:12:16 -0300
commit4d413c812db9ec8783471700c09ac270e16d097f (patch)
tree54ed8ccca66fc792d7e08714570440e4d2031e5b /src/ninep/ctl.zig
parent742d986c1b773baba11b897598e870131b9b874b (diff)
downloadpardes-4d413c812db9ec8783471700c09ac270e16d097f.tar.gz
pardes-4d413c812db9ec8783471700c09ac270e16d097f.zip
A test: a malformed address is bad address syntax, EINVAL, on a terminal as on a text
Round 20 reported a malformed address on a terminal answering otherwise; it answers `bad address syntax` here, as on a text pane, and this holds it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src/ninep/ctl.zig')
-rw-r--r--src/ninep/ctl.zig15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/ninep/ctl.zig b/src/ninep/ctl.zig
index cf2068bc..c0695c76 100644
--- a/src/ninep/ctl.zig
+++ b/src/ninep/ctl.zig
@@ -2046,6 +2046,21 @@ test "a tag write refuses NUL and the other control characters" {
}
}
+test "a malformed address is bad address syntax, on a terminal as on a text" {
+ const p = try th.withTerm(testing.allocator);
+ defer p.deinit();
+ const t = try withFile(testing.allocator, "one\n");
+ defer t.deinit();
+ for ([_]*pardes.Pardes{ p, t }) |q| {
+ for ([_][]const u8{ "1x", "/(/", ",,x" }) |expr| {
+ const refused = wr(q, Node.of(serialOf(q), .addr), expr);
+ try testing.expectEqual(E.INVAL, refused.errno());
+ try testing.expect(refused.reply.ename.len > 0);
+ }
+ try testing.expectEqualStrings("bad address syntax", wr(q, Node.of(serialOf(q), .addr), "1x").reply.ename);
+ }
+}
+
test "size is monotonic: growing is never refused, and a size once taken is taken again" {
const p = try Pardes.init(testing.allocator, .{ .tty_only = true, .cols = 160, .rows = 60 });
defer p.deinit();