diff options
Diffstat (limited to 'test')
| -rw-r--r-- | test/fs.py | 19 |
1 files changed, 19 insertions, 0 deletions
@@ -381,6 +381,25 @@ def discovery(binary, embedded=False): # Through a mount both read as EINVAL; the log says which and why. assert f'err {scratch} addr: no match for regexp\n'.encode() in client.read('/log') client.remove(f'/pane/{scratch}') + # Real `diff -u` in a command pane: the terminal turns the tab + # before each timestamp into blanks, and a look at a changed line + # still opens the new file at it. + (root / 'diff-old.txt').write_text('one\ntwo\nthree\n') + (root / 'diff-new.txt').write_text('one\nTWO\nthree\n') + seen = client.read('/log').decode().count('\nexit ') + client.write('/exec', b'diff -u diff-old.txt diff-new.txt\n') + deadline = time.monotonic() + 10 + while client.read('/log').decode().count('\nexit ') <= seen: + assert time.monotonic() < deadline, 'diff -u never ended' + time.sleep(.05) + ran = [row.split()[0] for row in client.read('/index').decode().splitlines() if row.split()[1] == 'term'] + shown = client.read(f'/pane/{ran[-1]}/body').decode() + assert '+++ diff-new.txt' in shown and '\t' not in shown, shown + client.write(f'/pane/{ran[-1]}/look', b'+TWO\n') + opened = [row for row in client.read('/index').decode().splitlines() if row.split()[3] == f'{root}/diff-new.txt'] + assert len(opened) == 1, client.read('/index') + client.remove(f'/pane/{opened[0].split()[0]}') + client.remove(f'/pane/{ran[-1]}') # A Save makes the directories its file goes in, whatever names # it: the pane's own name or Save's path. # `~` is home (this session's HOME, the test's root) wherever a |
