summaryrefslogtreecommitdiff
path: root/test/behaviour
diff options
context:
space:
mode:
Diffstat (limited to 'test/behaviour')
-rw-r--r--test/behaviour/look_and_exec.zig21
1 files changed, 21 insertions, 0 deletions
diff --git a/test/behaviour/look_and_exec.zig b/test/behaviour/look_and_exec.zig
index 251b6325..3e6137b1 100644
--- a/test/behaviour/look_and_exec.zig
+++ b/test/behaviour/look_and_exec.zig
@@ -813,3 +813,24 @@ test "look-and-exec: a reading pane that walks to another file is the same pane:
try std.testing.expect(std.mem.indexOf(u8, log, s.at("del {d} ", .{r})) == null);
try std.testing.expect(std.mem.indexOf(u8, try s.read("/recent"), s.at("{s}/a.txt", .{dir})) != null);
}
+
+test "look-and-exec: a look whose file takes an untouched +New's place (UX J1) reads back that pane, by the +New's number: a terminal's look into the +New under it, the root's from the +New itself" {
+ var tmp = std.testing.tmpDir(.{});
+ defer tmp.cleanup();
+ try tmp.dir.writeFile(std.testing.io, .{ .sub_path = "a.txt", .data = "a\n" });
+ try tmp.dir.writeFile(std.testing.io, .{ .sub_path = "b.txt", .data = "b\n" });
+ var buf: [4096]u8 = undefined;
+ const dir = buf[0..try tmp.dir.realPath(std.testing.io, &buf)];
+ // As `pardes --tty` boots: a shell, an untouched +New under it.
+ var s = try Session.initTerm(std.testing.allocator);
+ defer s.deinit();
+ const shell = try s.focused();
+ for ([_][]const u8{ "a.txt", "b.txt" }, 0..) |name, i| {
+ try s.write(s.at("/pane/{d}/exec", .{shell}), "New\n");
+ const scratch = try s.focused();
+ try s.write(if (i == 0) s.at("/pane/{d}/look", .{shell}) else "/look", s.at("{s}/{s}\n", .{ dir, name }));
+ try s.expect(s.at("/pane/{d}/name", .{scratch}), s.at("{s}/{s}\n", .{ dir, name }));
+ try s.expect("/look", s.at("{d}\n", .{scratch}));
+ if (i == 0) try s.expect(s.at("/pane/{d}/look", .{shell}), s.at("{d}\n", .{scratch}));
+ }
+}