summaryrefslogtreecommitdiff
path: root/test/behaviour/look_and_exec.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-04 11:14:05 -0300
committerGabriel Schneider <[email protected]>2026-11-04 11:20:36 -0300
commitee36e1d07d455aed8b3895e35329b1de4c21ab94 (patch)
treef397e386517b696c9f60e98f21703402cd32d162 /test/behaviour/look_and_exec.zig
parent3c5cddb963c67df5df0ed0ec023d68e43ba26bd5 (diff)
downloadpardes-ee36e1d07d455aed8b3895e35329b1de4c21ab94.tar.gz
pardes-ee36e1d07d455aed8b3895e35329b1de4c21ab94.zip
test: review of the ctl migration: the second LookWord list look checked refilled with beta's places (its +Search body's words.txt:1:7-10), not only the one +Search; a failing builtin's test again refuses Msg a\x01b on the root exec with its control-character reason, as the old test did; a look opening a spaced path checks the source's ctl undo flag still 0 (the old revision and undo_len checks; the first 60 bytes stopped at dirty); a name's own backslash doubled in /index and in /recent's closed row moved to test/behaviour/other_files.zig through a name write to a file named back\nslash, the old /index and /recent tests trimmed to their setCwd control bytes and newline (no 9P name holds one); each checked to fail against a break (events' backslash doubling skipped, the second look searching alpha again, both control-character checks letting \x01 through); ten of the migrated tests checked against the reviewer's own breaks (fitErr's end left mid-character, Tab taking 0, a deleted file's Back step not going on, Delete asking, recentKeeps keeping a non-local name, a 1 MiB line not discarding its tail, is a dir not EISDIR, an event range backwards taken, DEL let through both checks, a remembered place's column clamped past the line)
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge
Diffstat (limited to 'test/behaviour/look_and_exec.zig')
-rw-r--r--test/behaviour/look_and_exec.zig11
1 files changed, 10 insertions, 1 deletions
diff --git a/test/behaviour/look_and_exec.zig b/test/behaviour/look_and_exec.zig
index 2ce95354..f769d72a 100644
--- a/test/behaviour/look_and_exec.zig
+++ b/test/behaviour/look_and_exec.zig
@@ -458,7 +458,11 @@ test "look-and-exec: a look opens spaced paths and locations without editing the
try expectEqual(@as(u32, 8), (try s.range(s.at("/pane/{d}/dot", .{opened})))[0]); // line 2, column 3
// The source: its text, its undo steps and its cursor as they were.
try s.expect(s.at("/pane/{d}/body", .{source}), "source stays intact\n");
- try std.testing.expectEqualStrings(ctl[0..60], (try s.read(s.at("/pane/{d}/ctl", .{source})))[0..60]);
+ const after = try s.read(s.at("/pane/{d}/ctl", .{source}));
+ try std.testing.expectEqualStrings(ctl[0..60], after[0..60]);
+ var fields = std.mem.tokenizeScalar(u8, after, ' ');
+ for (0..8) |_| _ = fields.next();
+ try std.testing.expectEqualStrings("0", fields.next().?); // still no undo step
try expectEqual(.{ @as(u32, 3), @as(u32, 3) }, try s.range(s.at("/pane/{d}/dot", .{source})));
try s.expect("/look", s.at("{d}\n", .{opened}));
// From the root, with the source focused: the same pane, moved.
@@ -623,6 +627,8 @@ test "look-and-exec: a second LookWord list look in a directory refills its +Sea
try s.write(s.at("/pane/{d}/look", .{n}), "beta\n");
try expectEqual(@as(usize, 1), std.mem.count(u8, try s.read("/index"), "/+Search "));
try expectEqual(first, try paneNamed(&s, "/+Search"));
+ // Refilled with beta's places (columns 7-10), not alpha's.
+ try std.testing.expect(has(try s.read(s.at("/pane/{d}/body", .{first})), "words.txt:1:7-10\n"));
}
test "look-and-exec: `@pN:` looks at pane N as `a.txt:` looks at a.txt, and a line past the end is said one way, `:N` or `file:N`" {
@@ -668,6 +674,9 @@ test "look-and-exec: a builtin that fails through exec, tagexec or a column's ex
// the same record, counted.
try expectEqual(@as(usize, 3), std.mem.count(u8, log, "Unmount: no such mount zzz"));
try std.testing.expect(has(log, "mount zzz (x2)"));
+ // A control character is refused with its reason.
+ try expectEqual(@as(u16, 22), try s.refused("/exec", "Msg a\x01b\n"));
+ try std.testing.expectEqualStrings("invalid command line: it holds a control character (or DEL) other than a tab", s.said);
// A look miss: one err, no msg; the same miss again is that record counted.
try s.write("/look", "zzqqnotthere\n");
try std.testing.expect(has(try s.read("/log"), "look: no match for \"zzqqnotthere\""));