summaryrefslogtreecommitdiff
path: root/test/behaviour/other_files.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-03 16:17:51 -0300
committerGabriel Schneider <[email protected]>2026-11-03 16:21:16 -0300
commitd197289c331365081295cb44f27ee2893294cffa (patch)
treef4d64abdcdfcb714ece786fd050264dcc22a2bf5 /test/behaviour/other_files.zig
parent86e9f8e241df16d96df542e08684af638c39fb89 (diff)
downloadpardes-d197289c331365081295cb44f27ee2893294cffa.tar.gz
pardes-d197289c331365081295cb44f27ee2893294cffa.zip
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 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge
Diffstat (limited to 'test/behaviour/other_files.zig')
-rw-r--r--test/behaviour/other_files.zig23
1 files changed, 23 insertions, 0 deletions
diff --git a/test/behaviour/other_files.zig b/test/behaviour/other_files.zig
new file mode 100644
index 00000000..b97affc4
--- /dev/null
+++ b/test/behaviour/other_files.zig
@@ -0,0 +1,23 @@
+//! docs/typ/reference.typ, Other files <other-files>.
+const std = @import("std");
+const Session = @import("session").Session;
+
+test "other-files: kbdin types at the pane with the keyboard and mousein clicks, each done before its write is answered" {
+ var s = try Session.initFile(std.testing.allocator, "x\n");
+ defer s.deinit();
+ const body = try std.fmt.allocPrint(s.arena.allocator(), "/pane/{d}/body", .{try s.focused()});
+ try s.keys("ihello \x1b");
+ try s.expect(body, "hello x\n");
+ // Plan 9's Khome rune, then text before it.
+ try s.keys("A!\x1b\u{F00D}i>\x1b");
+ try s.expect(body, ">hello x!\n");
+ // A left click on the second l, then text there.
+ try s.click(">hello", 4, 1);
+ try s.keys("i#\x1b");
+ try s.expect(body, ">hel#lo x!\n");
+ // Refused, in words, as rio and devmouse refuse.
+ try std.testing.expectEqual(@as(u16, 22), try s.refused("/mousein", "m 1 2\n"));
+ try std.testing.expectEqual(@as(u16, 22), try s.refused("/mousein", "x 1 2 0\n"));
+ try std.testing.expectEqual(@as(u16, 22), try s.refused("/kbdin", "\xff"));
+ try std.testing.expectError(error.Refused, s.read("/kbdin"));
+}