diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-03 17:25:14 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-03 17:25:22 -0300 |
| commit | 289d0f1e5d46bea014dbcfe671d84ac09bebe247 (patch) | |
| tree | 2e1f639b7bb4c455ffecf30c42be1a3f4b232f87 /src/ninep | |
| parent | 5e778c87a33688c0079c916023d9c337dc944a69 (diff) | |
| download | pardes-289d0f1e5d46bea014dbcfe671d84ac09bebe247.tar.gz pardes-289d0f1e5d46bea014dbcfe671d84ac09bebe247.zip | |
test: three more of src/ninep/ctl.zig's tests through the 9P tree alone (test/behaviour/look_and_exec, columns_and_tags): look and exec reading back what the last command touched (a Tty made through a pane's ctl, a ctl write that makes nothing, a closed pane never a look's answer), a # line running as nothing at every exec and ctl (/index and /log unchanged), a refused Delcol changing no pane, layout or focus; each checked to fail against a break: a look answering a closed pane, a long # line run, a refused Delcol opening its +Unsaved
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge
Diffstat (limited to 'src/ninep')
| -rw-r--r-- | src/ninep/ctl.zig | 64 |
1 files changed, 0 insertions, 64 deletions
diff --git a/src/ninep/ctl.zig b/src/ninep/ctl.zig index 7441afeb..bd460098 100644 --- a/src/ninep/ctl.zig +++ b/src/ninep/ctl.zig @@ -2192,29 +2192,6 @@ test "a look line's trailing colon is dropped, and a look whose address fails ne } -test "look and exec read back what the last command touched, a ctl write's too" { - const gpa = testing.allocator; - const p = try withFile(gpa, "x\n"); - defer p.deinit(); - const serial = serialOf(p); - var want: [32]u8 = undefined; - _ = wr(p, root_exec, "Msg first\n"); - try testing.expectEqualStrings(try std.fmt.bufPrint(&want, "{d}\n", .{serial}), rd(p, root_exec, 0, 64).bytes); - // A pane made through ctl is what both read next, not the Msg's pane. - try testing.expectEqual(tree.Status.ok, wr(p, Node.of(serial, .ctl), "Tty\n").reply.status); - const made = p.panes[p.active].?.serial; - try testing.expect(made != serial); - try testing.expectEqualStrings(try std.fmt.bufPrint(&want, "{d}\n", .{made}), rd(p, root_exec, 0, 64).bytes); - try testing.expectEqualStrings(try std.fmt.bufPrint(&want, "{d}\n", .{made}), rd(p, @backingInt(tree.TopFile.look), 0, 64).bytes); - // A ctl write that makes nothing names the pane it ran at. - try testing.expectEqual(tree.Status.ok, wr(p, @backingInt(tree.TopFile.ctl), "Verbose off\n").reply.status); - try testing.expectEqualStrings(try std.fmt.bufPrint(&want, "{d}\n", .{made}), rd(p, root_exec, 0, 64).bytes); - // Closed, it is no pane to go to: a fresh read of look is empty. - try testing.expectEqual(tree.Status.ok, wr(p, Node.of(made, .ctl), "Del\n").reply.status); - try testing.expect(p.paneBySerial(made) == null); - try testing.expectEqualStrings("", rd(p, @backingInt(tree.TopFile.look), 0, 64).bytes); -} - test "a builtin's Verbose announcement is logged only when it succeeds, its failure said now or by the host later" { const gpa = testing.allocator; const p = try withFile(gpa, "x\n"); @@ -3158,24 +3135,6 @@ test "a Restore of a name in the DumpDir asks for, and logs, the whole path it r try testing.expectEqualStrings(try std.fmt.bufPrint(&want, "{s}/x.dump.zon", .{dir}), p.restore_req.?); } -test "a line starting with # runs as nothing at an exec or a ctl, silently" { - const p = try withFile(testing.allocator, "x\n"); - defer p.deinit(); - const serial = serialOf(p); - // The setup's own announcements are made by the first write's update. - _ = wr(p, @backingInt(tree.TopFile.ctl), "# settle\n"); - const before = p.next_serial; - const log_before = try pardes.ctlfs.events.freezeLog(p); - defer p.gpa.free(log_before.bytes); - for ([_]u64{ @backingInt(tree.TopFile.exec), Node.of(serial, .exec), @backingInt(tree.TopFile.ctl), Node.of(serial, .ctl), Node.ofCol(layout.columnSerial(p, 0), .ctl) }) |node| { - try testing.expectEqual(Status.ok, wr(p, node, "# Platform: tty\n # indented too\n").reply.status); - } - try testing.expectEqual(before, p.next_serial); - const log_after = try pardes.ctlfs.events.freezeLog(p); - defer p.gpa.free(log_after.bytes); - try testing.expectEqualStrings(log_before.bytes, log_after.bytes); -} - test "a builtin that takes no argument, written with one to an exec, is refused wrong #args, as at a ctl" { const p = try withFile(testing.allocator, "x\n"); @@ -4165,29 +4124,6 @@ test "@p<terminal>:<address> takes any address over the terminal's lines, select try testing.expectEqualStrings("", rd(p, root, 0, 64).bytes); } -test "a refused Delcol changes nothing: no pane, no focus" { - const p = try withFile(testing.allocator, "x\n"); - defer p.deinit(); - _ = wr(p, @backingInt(tree.TopFile.ctl), "Newcol\n"); - const made = try th.newPane(p); - _ = wr(p, Node.of(made, .name), "/tmp/pardes-delcol-refused.txt\n"); - _ = wr(p, Node.of(made, .body), "edit\n"); - p.sync(); - const col = layout.findPane(p, p.paneBySerial(made).?).?.col; - const active = p.active; - const active_column = p.active_column; - var count: usize = 0; - for (p.panes) |slot| count += @intFromBool(slot != null); - try testing.expectEqual(Status.err, wr(p, Node.ofCol(layout.columnSerial(p, col), .ctl), "Delcol\n").reply.status); - p.sync(); - var after: usize = 0; - for (p.panes) |slot| after += @intFromBool(slot != null); - try testing.expectEqual(count, after); - try testing.expectEqual(active, p.active); - try testing.expectEqual(active_column, p.active_column); - try testing.expect(th.logHas(p, "unsaved ")); -} - test "what a /pager open writes after its directory is the text: plain in the body, its colours the pane's, clean, in by the read" { const p = try withFile(testing.allocator, "x\n"); defer p.deinit(); |
