diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-10 09:22:10 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-10 09:29:11 -0300 |
| commit | e617ee11b6fafd48278ef0e371fa1981f8559413 (patch) | |
| tree | 106b973366d1905e38b009b8b5b1d3005b8eb4ba /test | |
| parent | 3eb166e287ec5afbd54b03a86711610e1b5269b6 (diff) | |
| download | pardes-e617ee11b6fafd48278ef0e371fa1981f8559413.tar.gz pardes-e617ee11b6fafd48278ef0e371fa1981f8559413.zip | |
history: a +History row reads `Restore <label>` before its date, size and panes, and a click on that Restore (an exec, or a look) is a Restore of that row's dump, exec.operandAt expanding the word to the label beside it as the row reads, where a bare Restore would have been this session's last dump; a look of the whole row reads past the word; the behaviour test clicks a row's Restore and looks at a row
Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge
Diffstat (limited to 'test')
| -rw-r--r-- | test/behaviour/root_ctl.zig | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/test/behaviour/root_ctl.zig b/test/behaviour/root_ctl.zig index 1fa67206..a3379685 100644 --- a/test/behaviour/root_ctl.zig +++ b/test/behaviour/root_ctl.zig @@ -264,7 +264,7 @@ test "root-ctl: a Dump killed in the middle leaves the one before it whole, and try std.testing.expectEqual(@as(usize, 2), (try labels(&s)).len); } -test "root-ctl: a session's end leaves a slim dump the next session's History lists with the panes' names, a look at its row restores the file pane, and a session of shells alone leaves none" { +test "root-ctl: a session's end leaves a slim dump the next session's History lists as `Restore <label>` with the panes' names, a middle click on the Restore or a look at the row restores the file pane, and a session of shells alone leaves none" { var tmp = std.testing.tmpDir(.{}); defer tmp.cleanup(); var dir_buf: [std.fs.max_path_bytes]u8 = undefined; @@ -294,10 +294,22 @@ test "root-ctl: a session's end leaves a slim dump the next session's History li try s.write("/exec", "History\n"); const hist = std.mem.trimEnd(u8, try s.read("/exec"), "\n"); const body = try s.read(s.at("/pane/{s}/body", .{hist})); - try std.testing.expect(std.mem.startsWith(u8, body, listed[0])); + try std.testing.expect(std.mem.startsWith(u8, body, s.at("Restore {s} ", .{listed[0]}))); try std.testing.expect(has(body, "a.txt")); - // A look at the row: the dump restored, the file pane back with its text. - try s.write(s.at("/pane/{s}/look", .{hist}), body[0..std.mem.indexOfScalar(u8, body, '\n').?]); + // A middle click on the row's Restore: that row's dump restored, the + // file pane back with its text; a bare Restore would have been this + // session's last dump, of which there is none. + try s.click(s.at("Restore {s}", .{listed[0]}), 2, 2); try std.testing.expect(has(try s.read("/log"), s.at("restore {s}\n", .{listed[0]}))); try s.expect(s.at("/pane/{d}/body", .{try s.lookFile(s.at("{s}/a.txt", .{dir}))}), "kept on disk\n"); + // A look at the whole row is the same Restore. + try s.write("/exec", "History\n"); + const again = std.mem.trimEnd(u8, try s.read("/exec"), "\n"); + const row = try s.read(s.at("/pane/{s}/body", .{again})); + try s.write(s.at("/pane/{s}/look", .{again}), row[0..std.mem.indexOfScalar(u8, row, '\n').?]); + // The Restore replaced every pane, the +History among them, and the + // log starts over at a restore. + try std.testing.expect(has(try s.read("/log"), s.at("restore {s}\n", .{listed[0]}))); + try std.testing.expect(!has(try s.read("/index"), "+History")); + try s.expect(s.at("/pane/{d}/body", .{try s.lookFile(s.at("{s}/a.txt", .{dir}))}), "kept on disk\n"); } |
