summaryrefslogtreecommitdiff
path: root/test/soak.py
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-16 23:58:16 -0300
committerGabriel Schneider <[email protected]>2026-11-17 12:15:01 -0300
commitfa504c392b5f3c04a7cfce74566e23cb94ddd6cf (patch)
tree71dbd6320f6238c07deb23e5727b4c5afd96a61f /test/soak.py
parent162d7ec610b770c27b9a7c481f66c6f2e4898bd5 (diff)
downloadpardes-fa504c392b5f3c04a7cfce74566e23cb94ddd6cf.tar.gz
pardes-fa504c392b5f3c04a7cfce74566e23cb94ddd6cf.zip
test: a +Diff pinned before it moves: process-test's `diffstack` pages a patch into `pardes -` and snaps the +Diff it is restacked into (its hunk found two lines down where the file moved it, under the declaration it stands in, `a.zig:3` and `const S = struct {`, its label one level deep, `a.zig:5 *`; the changed word on a stronger ground in both lines, a line added whole on a faint one, the markers in their tints' hue), as text and as styles; replicas opens with a .patch looked at by the authority and as the replica's own input, the first stopped at its first read and confirmed with no rollback, the replica's digest and +Diff the authority's either way; the soak's fixture is a repository whose last commit changes code.zig, and `gitshow` pages `git show HEAD` into `pardes -` from a shell
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
Diffstat (limited to 'test/soak.py')
-rw-r--r--test/soak.py21
1 files changed, 20 insertions, 1 deletions
diff --git a/test/soak.py b/test/soak.py
index 401cb84e..faf447ab 100644
--- a/test/soak.py
+++ b/test/soak.py
@@ -148,6 +148,15 @@ def fixture(at, rng):
sub.mkdir(exist_ok=True)
(sub / 'inner.txt').write_text(''.join(f'inner {i} {rng.choice(WORDS)}\n' for i in range(60)))
(sub / 'more.md').write_text('# More\n\n' + ''.join(f'- item {i} {rng.choice(WORDS)}\n' for i in range(40)))
+ # A repository whose last commit changes code.zig, for act_gitshow.
+ if shutil.which('git'):
+ git = ['git', '-c', 'user.name=soak', '-c', 'user.email=soak@invalid', '-c', 'init.defaultBranch=main']
+ subprocess.run(git + ['init', '-q'], cwd=at, check=True)
+ subprocess.run(git + ['add', 'code.zig'], cwd=at, check=True)
+ subprocess.run(git + ['commit', '-qm', 'code'], cwd=at, check=True)
+ code = (at / 'code.zig').read_text().replace('return x * 7 +', 'return x * 8 +').replace('pub fn f9(', 'pub fn nine(')
+ (at / 'code.zig').write_text(code)
+ subprocess.run(git + ['commit', '-qam', 'change'], cwd=at, check=True)
# ---- terminals ----
@@ -681,6 +690,16 @@ def act_shell(c, rng, k):
k(rng.choice([b'k', b'j', b'']))
+def act_gitshow(c, rng, k):
+ # A commit paged into `pardes -` (git's pager): the +Pager restacked into
+ # a +Diff, whose rows come from the files the step reads (hunks.zig).
+ k(b' nt')
+ time.sleep(rng.uniform(0.8, 1.5))
+ k(b'git show HEAD | "$(readlink /proc/$PPID/exe)" -\r')
+ time.sleep(rng.uniform(1.0, 2.0))
+ k(b'\x02')
+
+
def act_window(c, rng, k):
# Enter ends window mode, as a person would: left open, it took the next
# action's keys, and a `k` at a column's top went to its tag, where `SPC q` ran Exit
@@ -762,7 +781,7 @@ ACTIONS = [
('panes', 3, act_panes), ('find', 3, act_find), ('shell', 3, act_shell), ('window', 4, act_window),
('column', 1, act_column), ('del', 2, act_del), ('new', 2, act_new), ('esc', 4, act_esc),
('click', 8, act_click), ('wheel', 8, act_wheel), ('hover', 6, act_hover), ('paste', 2, act_paste),
- ('settings', 1, act_settings), ('idle', 6, act_idle),
+ ('settings', 1, act_settings), ('gitshow', 1, act_gitshow), ('idle', 6, act_idle),
]