summaryrefslogtreecommitdiff
path: root/test/snapshots/filewatch.snap
diff options
context:
space:
mode:
Diffstat (limited to 'test/snapshots/filewatch.snap')
-rw-r--r--test/snapshots/filewatch.snap43
1 files changed, 31 insertions, 12 deletions
diff --git a/test/snapshots/filewatch.snap b/test/snapshots/filewatch.snap
index 1ac8d081..6f1f2976 100644
--- a/test/snapshots/filewatch.snap
+++ b/test/snapshots/filewatch.snap
@@ -1,7 +1,23 @@
# external file updates: a write from outside pardes lands in the open pane,
# and Undo brings the unsaved edit back. That is the whole contract — the
# update is committed like any other edit, so nothing has to be merged.
-lines w.txt 12
+#
+# The writer must be a STRANGER to the editor. This script used to have a
+# pardes PANE run the write, which proved much less than it looked: that
+# shell's own pty output wakes the loop and paints a frame, so the reload
+# could be riding on the keystroke's frame instead of on the watch. `run` is a
+# child of the RUNNER — nothing it does reaches an app pty — and every
+# assertion below it is a `wait`, which only READS the pty. So between the
+# write and the reload the app receives no keystroke, no resize, no mouse: if
+# the watch does not wake the loop by itself, these waits time out.
+#
+# Two files in two directories, written the two ways files actually change:
+# w.txt in place (CLOSE_WRITE) and sub/s.txt by rename-over, which is what
+# `zig fmt`, `git checkout` and every editor's atomic save do (MOVED_TO, and
+# a new inode — the reason the mark is on the directory).
+dirmk sub
+file w.txt line 1\nline 2\n/tmp/pardes-snap/filewatch/cwd/sub/s.txt\nline 4\nline 5\nline 6\nline 7\nline 8\nline 9\nline 10\nline 11\nline 12\n
+lines sub/s.txt 8
start 30 150 -n 3
wait 8000 w.txt
stable 700 20000
@@ -15,9 +31,15 @@ key esc
settle 100
press right 6 8
release right 6 8
-wait 10000 line 3
+wait 10000 line 4
stable 700 15000
-# an UNSAVED edit on line 1
+# ...and open sub/s.txt from the path sitting on line 3 of that pane, so the
+# second watched pane is in a DIFFERENT directory from the first
+press right 20 5
+release right 20 5
+wait 10000 line 8
+stable 700 15000
+# an UNSAVED edit on line 1 of w.txt
press left 10 3
release left 10 3
stable 400 5000
@@ -27,18 +49,15 @@ key esc
settle 100
stable 400 5000
snap edited
-# overwrite the file from a shell in another column. The marker is split so
-# the ECHOED command line never matches the wait — only the reloaded pane does
-press left 60 5
-release left 60 5
-stable 400 5000
-key c-b
-stable 600 8000
-text echo EXTERN''AL > w.txt
-key enter
+# ---- from here to `snap reloaded_sub`, pardes is sent NOTHING ----
+run printf 'EXTERNAL\n' > w.txt
wait 10000 EXTERNAL
stable 700 10000
snap reloaded
+run printf 'RENAMED\n' > sub/t && mv sub/t sub/s.txt
+wait 10000 RENAMED
+stable 700 10000
+snap reloaded_sub
# back in the file pane: one undo and the unsaved edit is there again
press left 10 3
release left 10 3