summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/snapshot.zig4
-rw-r--r--test/snapshots/restore.golden62
-rw-r--r--test/snapshots/restore.snap25
3 files changed, 91 insertions, 0 deletions
diff --git a/test/snapshot.zig b/test/snapshot.zig
index 10aa0c86..54ba0271 100644
--- a/test/snapshot.zig
+++ b/test/snapshot.zig
@@ -130,6 +130,10 @@ fn runScript(arena: std.mem.Allocator, exe_z: [:0]const u8, script_path: []const
_ = setenv("HOME", try arena.dupeZ(u8, home), 1);
_ = setenv("TERM", "xterm-256color", 1);
_ = setenv("LC_ALL", "C", 1);
+ // pin the dump path: live runs use a timestamped file under the user data
+ // dir (dump.outPath), which would make the dump/load/restore goldens
+ // nondeterministic
+ _ = setenv("PARDES_DUMP", "/tmp/pardes-dump.zon", 1);
if (chdirRc(try arena.dupeZ(u8, work)) < 0) return error.ChdirFailed;
var out: std.ArrayList(u8) = .empty;
diff --git a/test/snapshots/restore.golden b/test/snapshots/restore.golden
new file mode 100644
index 00000000..6b8c4d7e
--- /dev/null
+++ b/test/snapshots/restore.golden
@@ -0,0 +1,62 @@
+== snap dumped grid=100x30 cursor=4,5
+|Kill Newcol Tutor Debug Colors NextColor Dump Restore /tmp/pardes-dump.zon
+| TTY /tmp/pardes-snap/restore/cwd Del
+| $ ls
+| $ echo KEEP''ME
+| KEEPME
+| $
+|
+|
+|
+|
+|
+|
+|
+|
+|
+|
+|
+|
+|
+|
+|
+|
+|
+|
+|
+|
+|
+|
+|
+|
+== snap restored grid=100x30 cursor=4,5
+|Kill Newcol Tutor Debug Colors NextColor Dump
+| TTY /tmp/pardes-snap/restore/cwd Del
+| $ ls
+| $ echo KEEP''ME
+| KEEPME
+| $
+|
+|
+|
+|
+|
+|
+|
+|
+|
+|
+|
+|
+|
+|
+|
+|
+|
+|
+|
+|
+|
+|
+|
+|
diff --git a/test/snapshots/restore.snap b/test/snapshots/restore.snap
new file mode 100644
index 00000000..8a677877
--- /dev/null
+++ b/test/snapshots/restore.snap
@@ -0,0 +1,25 @@
+# Dump writes to the resolved dump path ($PARDES_DUMP here; a timestamped file
+# under ~/.local/share/pardes in live runs) and the topbar grows Restore <path>;
+# middle-click Restore loads that dump back into the live session: output on
+# screen at Dump time survives (pty history), later output does not
+start 30 100
+wait 8000 Kill Newcol
+stable 700 20000
+key c-b
+stable 600 8000
+text echo KEEP''ME
+key enter
+wait 8000 KEEPME
+stable 700 10000
+press middle 42 1
+release middle 42 1
+stable 700 10000
+snap dumped
+text echo GONE''SOON
+key enter
+wait 8000 GONESOON
+stable 700 10000
+press middle 48 1
+release middle 48 1
+stable 900 15000
+snap restored