summaryrefslogtreecommitdiff
path: root/test/behaviour/other_files.zig
diff options
context:
space:
mode:
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"));
+}