diff options
Diffstat (limited to 'test/behaviour/other_files.zig')
| -rw-r--r-- | test/behaviour/other_files.zig | 17 |
1 files changed, 17 insertions, 0 deletions
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}))); +} |
