summaryrefslogtreecommitdiff
path: root/test/soak.py
diff options
context:
space:
mode:
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),
]