From d197289c331365081295cb44f27ee2893294cffa Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Tue, 3 Nov 2026 16:17:51 -0300 Subject: test: the behaviour-test step and test/session.zig, T1 of docs/next-tests.md: a Session drives the core as a 9P client does (walk by path, open, read or write, clunk, held lines run at the clunk as src/9p_io.zig runs them), the core opaque and the step's module importing session alone, so a behavioural test cannot reach past the 9P tree; keys (kbdin), click (on text found on /screen, mousein), screen, focused, refused and the refusal's words; test/behaviour/{other_files,panes,edit}.zig, a file a section of the reference: kbdin and mousein, a collapsed pane's ctl, name's leading blank, Putall, Edit blocks, moved out of src/ninep/ctl.zig (an Edit block left open now checked as a client sees it, an err in the log at its clunk), each checked to fail against a break (collapsed left off the ctl read, Putall saving nothing); the plan doc says the layout, the decisions and the progress Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge --- src/ninep/ctl.zig | 85 ------------------------------------------------------- 1 file changed, 85 deletions(-) (limited to 'src') diff --git a/src/ninep/ctl.zig b/src/ninep/ctl.zig index 37f27dac..69a0e791 100644 --- a/src/ninep/ctl.zig +++ b/src/ninep/ctl.zig @@ -1681,22 +1681,6 @@ test "Edit through a pane's ctl renames every foo in one undo step, and a failed try testing.expectEqualStrings("foo x foo y foo\n", rd(p, body, 0, 64).bytes); } -test "a write of an Edit block carries it whole, to a pane's ctl, the root's ctl and exec" { - const p = try withFile(testing.allocator, "foo x\nfoo y\n"); - defer p.deinit(); - const serial = serialOf(p); - const body = Node.of(serial, .body); - try testing.expectEqual(Status.ok, wr(p, Node.of(serial, .ctl), "Edit ,x/foo/{\ni/[/\na/]/\n}\n").reply.status); - try testing.expectEqualStrings("[foo] x\n[foo] y\n", rd(p, body, 0, 64).bytes); - p.active = p.paneBySerial(serial).?; - try testing.expectEqual(Status.ok, wr(p, @backingInt(tree.TopFile.ctl), "Edit ,x/\\[/{\nc/\x1b").errno()); - try testing.expectEqualStrings(">hello x!\n", rd(p, body, 0, 64).bytes); - // A left click on the second l, then text there; where it is, as a - // client reads it off /screen, from a frame drawn. - var frame: std.heap.ArenaAllocator = .init(p.gpa); - defer frame.deinit(); - _ = try p.render(frame.allocator()); - const id = p.paneBySerial(s).?; - const pane = p.panes[id].?; - const r = p.rects[id]; - var line: [64]u8 = undefined; - const at = .{ r.x + config.GUTTER + panes.File.gutterWidth(pane) + 4, p.bodyTop(pane, r) }; - try testing.expectEqual(@as(u16, 0), wr(p, mousein, try std.fmt.bufPrint(&line, "m {d} {d} 1\nm {d} {d} 0\n", at ++ at)).errno()); - try testing.expectEqual(@as(u16, 0), wr(p, kbdin, "i#\x1b").errno()); - try testing.expectEqualStrings(">hel#lo x!\n", rd(p, body, 0, 64).bytes); - // Refused, in words, as rio and devmouse refuse. - try testing.expectEqual(E.INVAL, wr(p, mousein, "m 1 2\n").errno()); - try testing.expectEqual(E.INVAL, wr(p, mousein, "x 1 2 0\n").errno()); - try testing.expectEqual(E.INVAL, wr(p, kbdin, "\xff").errno()); - try testing.expectEqual(E.PERM, rd(p, kbdin, 0, 64).errno()); -} -- cgit v1.3