diff options
| author | Gabriel Schneider <[email protected]> | 2026-10-01 02:52:43 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-10-01 02:52:43 -0300 |
| commit | 0f5773256072b08a1ec294fa63822f63eb6a429b (patch) | |
| tree | f1aa96433911abe340cd141fe87a7fde27ed7e8f /src/ninep/ctl.zig | |
| parent | 083167d5b6bc403395f18ddb5e07a2743bb2632f (diff) | |
| download | pardes-0f5773256072b08a1ec294fa63822f63eb6a429b.tar.gz pardes-0f5773256072b08a1ec294fa63822f63eb6a429b.zip | |
addr, dot and limit on a pane with no text, a terminal, an image or a PDF, are refused alike: "this pane has no text to address"
A terminal took an addr write and evaluated it over nothing, saying
"bad address syntax" or "address out of range" by the expression, while
dot refused it as no text at all. A range file of a pane with no text
now refuses every write the same way, before the expression is read.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src/ninep/ctl.zig')
| -rw-r--r-- | src/ninep/ctl.zig | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/src/ninep/ctl.zig b/src/ninep/ctl.zig index 5d08a77f..42b88b91 100644 --- a/src/ninep/ctl.zig +++ b/src/ninep/ctl.zig @@ -3234,19 +3234,23 @@ 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" { +test "a malformed address is bad address syntax; on a pane with no text any address is refused as nothing to address" { 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); + for ([_][]const u8{ "1x", "/(/", ",,x" }) |expr| { + const refused = wr(t, Node.of(serialOf(t), .addr), expr); + try testing.expectEqual(E.INVAL, refused.errno()); + try testing.expect(refused.reply.ename.len > 0); } + try testing.expectEqualStrings("bad address syntax", wr(t, Node.of(serialOf(t), .addr), "1x").reply.ename); + // A terminal (as an image or a PDF): addr, dot and limit alike. + for ([_]tree.PaneFile{ .addr, .dot, .limit }) |file| for ([_][]const u8{ "1", "1x" }) |expr| { + const refused = wr(p, Node.of(serialOf(p), file), expr); + try testing.expectEqual(E.INVAL, refused.errno()); + try testing.expectEqualStrings("this pane has no text to address", refused.reply.ename); + }; } test "a bad event record says what is wrong with it" { |
