summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/behaviour/look_and_exec.zig23
-rw-r--r--test/process/window.zig11
2 files changed, 29 insertions, 5 deletions
diff --git a/test/behaviour/look_and_exec.zig b/test/behaviour/look_and_exec.zig
index a7de93cd..251b6325 100644
--- a/test/behaviour/look_and_exec.zig
+++ b/test/behaviour/look_and_exec.zig
@@ -790,3 +790,26 @@ test "look-and-exec: a look at a directory opens a pane listing it, as acme's di
try std.testing.expectEqualStrings("later", again[1]);
try std.testing.expectEqualStrings("sub/", again[2]);
}
+
+test "look-and-exec: a reading pane that walks to another file is the same pane: its number, an open of its files reading the new text, /log's rename for it, the file it left in Recent" {
+ 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 s = try Session.initFile(std.testing.allocator, "x\n");
+ defer s.deinit();
+ var buf: [4096]u8 = undefined;
+ const dir = buf[0..try tmp.dir.realPath(std.testing.io, &buf)];
+ const r = try s.lookFile(s.at("{s}/a.txt", .{dir}));
+ const body = try s.hold(s.at("/pane/{d}/body", .{r}), 0);
+ // A step in place: b.txt in the pane a.txt was in.
+ try s.write(s.at("/pane/{d}/look", .{r}), s.at("{s}/b.txt\n", .{dir}));
+ try expectEqual(r, try s.focused());
+ try s.expect(s.at("/pane/{d}/name", .{r}), s.at("{s}/b.txt\n", .{dir}));
+ try std.testing.expectEqualStrings("b\n", try s.readFid(body));
+ s.clunk(body);
+ const log = try s.read("/log");
+ try std.testing.expect(std.mem.endsWith(u8, log, s.at("rename {d} {s}/b.txt\n", .{ r, dir })));
+ 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);
+}
diff --git a/test/process/window.zig b/test/process/window.zig
index 59c84616..2a1331ad 100644
--- a/test/process/window.zig
+++ b/test/process/window.zig
@@ -402,10 +402,10 @@ fn corpus(gpa: std.mem.Allocator, exe: [:0]const u8) !void {
defer arena.deinit();
const a = arena.allocator();
defer _ = system("rm -rf -- /tmp/pardes-gui-corpus");
- // Its Looks open panes and Del them by serial, as `Jumps new-pane`
- // does (SPEC ยง6.6): under walk a file pane steps in place, a new
- // serial, and the frames would not be the base's to compare.
- const init = "Shell /bin/sh\nTheme forge\nMessageLinger 0\nCursorBlink off\nJumps new-pane\n";
+ // Jumps walk, the default: the file pane's Looks at files step it in
+ // place, the same pane (its serial kept, Trail.show); a picture's and a
+ // PDF's open panes of their own.
+ const init = "Shell /bin/sh\nTheme forge\nMessageLinger 0\nCursorBlink off\n";
var k: Corpus = .{ .gpa = gpa, .a = a, .out = out };
{
try corpusRoot(a);
@@ -474,7 +474,8 @@ fn corpus(gpa: std.mem.Allocator, exe: [:0]const u8) !void {
const image = try paneWith(f, "ramp.ppm");
try k.keep(&d, 0, "09 an image pane", false);
try f.write(f.at("/pane/{d}/exec", .{image}), "Del\n");
- try f.write(f.at("/pane/{d}/exec", .{notes}), "Del\n");
+ // The file pane walks back to shapes.zig (its trail's step).
+ try f.write(f.at("/pane/{d}/look", .{notes}), root ++ "/shapes.zig\n");
try f.write(f.at("/pane/{d}/look", .{first}), root ++ "/doc.pdf\n");
_ = try paneWith(f, "doc.pdf");
try k.keep(&d, 0, "09 a PDF pane", false);