From ee36e1d07d455aed8b3895e35329b1de4c21ab94 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Wed, 4 Nov 2026 11:14:05 -0300 Subject: 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 Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge --- test/behaviour/other_files.zig | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'test/behaviour/other_files.zig') diff --git a/test/behaviour/other_files.zig b/test/behaviour/other_files.zig index 2d5cb112..701f4f14 100644 --- a/test/behaviour/other_files.zig +++ b/test/behaviour/other_files.zig @@ -309,3 +309,20 @@ test "other-files: a remembered place is clamped to the file as it is now, its s try std.testing.expectEqual(back, try s.focused()); try std.testing.expectEqual(dot, try s.range(s.at("/pane/{d}/dot", .{back}))); } + +test "other-files: /index and /recent show a name's own backslash doubled, so `\\n` written in a name reads back unlike a newline" { + var tmp = std.testing.tmpDir(.{}); + defer tmp.cleanup(); + try tmp.dir.writeFile(std.testing.io, .{ .sub_path = "back\\nslash", .data = "x\n" }); + var s = try Session.initFile(std.testing.allocator, "x\n"); + defer s.deinit(); + const dir = try tmpPath(&s, &tmp); + const n = try s.focused(); + try s.write(s.at("/pane/{d}/name", .{n}), s.at("{s}/back\\nslash\n", .{dir})); + const index = try s.read("/index"); + try std.testing.expect(has(index, s.at("{s}/back\\\\nslash ", .{dir}))); + try std.testing.expectEqual(@as(usize, 1), std.mem.count(u8, index, "\n")); + try s.write(s.at("/pane/{d}/exec", .{n}), "Get\n"); + try s.write(s.at("/pane/{d}/ctl", .{n}), "Del\n"); + try std.testing.expect(has(try s.read("/recent"), s.at("closed {s}/back\\\\nslash\n", .{dir}))); +} -- cgit v1.3