summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-03 16:52:58 -0300
committerGabriel Schneider <[email protected]>2026-11-03 16:52:58 -0300
commitd1273bbd99daf9b1855d82bf315db8ede20abde5 (patch)
tree14891fab4f951767dcf4d2b14470703055479b90 /test
parenta0320c49c1288e8e74f18983f18988a024952bb8 (diff)
downloadpardes-d1273bbd99daf9b1855d82bf315db8ede20abde5.tar.gz
pardes-d1273bbd99daf9b1855d82bf315db8ede20abde5.zip
fs: a pane's ctl read ends with its mode (mode:normal|insert|select|tty, select being normal mode extending), and kbdin takes Plan 9's Kalt, Kshift and Kctl runes (U+F015-F017), each adding its modifier to the key after it, an Alt or Ctrl key typing no text: the two surfaces the behavioural tests' inventory found most wanted (90 tests read body.mode, 18 send Alt or Shift); the tests that pinned the ctl line's end look for its words instead
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge
Diffstat (limited to 'test')
-rw-r--r--test/behaviour/other_files.zig7
-rw-r--r--test/behaviour/panes.zig13
-rw-r--r--test/fs.py4
-rw-r--r--test/pdf.zig2
-rw-r--r--test/record_demos.py5
5 files changed, 25 insertions, 6 deletions
diff --git a/test/behaviour/other_files.zig b/test/behaviour/other_files.zig
index b97affc4..c0f9c08f 100644
--- a/test/behaviour/other_files.zig
+++ b/test/behaviour/other_files.zig
@@ -21,3 +21,10 @@ test "other-files: kbdin types at the pane with the keyboard and mousein clicks,
try std.testing.expectEqual(@as(u16, 22), try s.refused("/kbdin", "\xff"));
try std.testing.expectError(error.Refused, s.read("/kbdin"));
}
+
+test "other-files: kbdin's Kalt rune is Alt on the key after it alone, and an Alt key types nothing" {
+ var s = try Session.initFile(std.testing.allocator, "x\n");
+ defer s.deinit();
+ try s.keys("i\u{F015}zy\x1b");
+ try s.expect(s.at("/pane/{d}/body", .{try s.focused()}), "yx\n");
+}
diff --git a/test/behaviour/panes.zig b/test/behaviour/panes.zig
index 45b7152c..01820a07 100644
--- a/test/behaviour/panes.zig
+++ b/test/behaviour/panes.zig
@@ -8,7 +8,18 @@ test "panes: a collapsed pane's ctl says so" {
const first = try s.focused();
_ = try s.newPane();
try s.write(s.at("/pane/{d}/ctl", .{first}), "Collapse\n");
- try std.testing.expect(std.mem.endsWith(u8, try s.read(s.at("/pane/{d}/ctl", .{first})), " collapsed "));
+ try std.testing.expect(std.mem.indexOf(u8, try s.read(s.at("/pane/{d}/ctl", .{first})), " collapsed ") != null);
+}
+
+test "panes: a pane's ctl read ends with its mode, as its tag's box shows it" {
+ var s = try Session.initFile(std.testing.allocator, "x\n");
+ defer s.deinit();
+ const ctl = s.at("/pane/{d}/ctl", .{try s.focused()});
+ try std.testing.expect(std.mem.endsWith(u8, try s.read(ctl), " mode:normal "));
+ try s.keys("i");
+ try std.testing.expect(std.mem.endsWith(u8, try s.read(ctl), " mode:insert "));
+ try s.keys("\x1bv");
+ try std.testing.expect(std.mem.endsWith(u8, try s.read(ctl), " mode:select "));
}
test "panes: the ctl word name refuses a leading blank, as the name file does" {
diff --git a/test/fs.py b/test/fs.py
index bd5ab501..5690cedc 100644
--- a/test/fs.py
+++ b/test/fs.py
@@ -267,8 +267,8 @@ def discovery(binary, embedded=False):
# wctl `current` does; a pane's ctl line ends saying which it is.
client.write('/focus', f'{first}\n'.encode())
assert client.read('/focus') == f'{first}\n'.encode()
- assert client.read(f'/pane/{first}/ctl').endswith(b' current ')
- assert client.read(f'/pane/{second}/ctl').endswith(b' notcurrent ')
+ assert b' current ' in client.read(f'/pane/{first}/ctl')
+ assert b' notcurrent ' in client.read(f'/pane/{second}/ctl')
try:
client.write('/focus', b'99999\n')
raise AssertionError('focus took a serial no pane has')
diff --git a/test/pdf.zig b/test/pdf.zig
index 3bb751e2..fca0c240 100644
--- a/test/pdf.zig
+++ b/test/pdf.zig
@@ -2418,7 +2418,7 @@ test "a PDF's fit and tint, and Collapse, read in its ctl and come back from a D
const ctlfs = pardes.ctlfs;
const ctl_node = ctlfs.Node.of(doc.serial, .ctl);
const read = p.fsPayload(p.serveFs(.{ .tag = 1, .op = .read, .node = ctl_node, .size = 4096 }));
- try std.testing.expect(std.mem.endsWith(u8, read, "fit:height tint:full "));
+ try std.testing.expect(std.mem.indexOf(u8, read, "fit:height tint:full ") != null);
try pardes.dump.dumpState(p);
const restored = try pardes.dump.restore(p, p.dump_out.?, "/tmp/pardes.dump.zon");
defer restored.deinit();
diff --git a/test/record_demos.py b/test/record_demos.py
index 3c64f55c..a2e48d73 100644
--- a/test/record_demos.py
+++ b/test/record_demos.py
@@ -819,8 +819,9 @@ def pdf_tint_fit(s):
s.pointer = s.cell_px(44, 12)
s.shot(1.2)
for _ in range(3):
- before = s.read('/pane/1/ctl').split()[-1]
- s.click(2, *pdf_tag(s, 'PdfTint'), done=lambda: s.read('/pane/1/ctl').split()[-1] != before,
+ tint = lambda: next(w for w in s.read('/pane/1/ctl').split() if w.startswith(b'tint:'))
+ before = tint()
+ s.click(2, *pdf_tag(s, 'PdfTint'), done=lambda: tint() != before,
what='the tint', after=1.0)
for fit in ('height', 'width'):
s.click(2, *pdf_tag(s, 'PdfFit'), done=lambda: f'fit:{fit}' in s.read('/pane/1/ctl'), what='the fit',