summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-10-01 01:14:37 -0300
committerGabriel Schneider <[email protected]>2026-10-01 01:35:12 -0300
commit77bda7e14e0ea81db5da54c233fc30d218773f47 (patch)
tree403fd24114e80d98318cf8b7cb827eda1b89c53c /test
parente6ff64843b4a8986e9740c576f346690217cf5a7 (diff)
downloadpardes-77bda7e14e0ea81db5da54c233fc30d218773f47.tar.gz
pardes-77bda7e14e0ea81db5da54c233fc30d218773f47.zip
pardes - keeps one +Pager per directory, refilled, named so from its first log record; streams the text in bounded writes; never loses it; handles \r, NUL and BEL as a terminal does
Each paged command made another +Pager until placement failed, and then git's text was lost with exit 0; a 130 MB page timed out half written and dirty; a directory whose name held a newline left a stray +New; and the log said new +New then rename. The root ctl's `pager <dir>` now makes the directory's +Pager (named before it is announced, placed without the keyboard) or empties the one there; the text goes into it a line-ended 8 MiB chunk a write, one undo step, up to the file limit and its note, and is left clean. A directory a ctl line cannot name pages into the session's. Any failure prints the text to stderr with why and exits 1. A carriage return keeps a progress line's last state and CRLF is a newline; NUL, BEL, SO and SI go; empty stdin makes no pane. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'test')
-rw-r--r--test/fs.py25
1 files changed, 25 insertions, 0 deletions
diff --git a/test/fs.py b/test/fs.py
index fce315fc..b2f52c3e 100644
--- a/test/fs.py
+++ b/test/fs.py
@@ -1456,7 +1456,32 @@ def test(binary, quic=False):
assert client.read(f'/pane/{made_now}/body') == b'bold text\n'
row = [r for r in client.read('/index').splitlines() if r.split()[0] == str(made_now).encode()][0]
assert row.split()[2] == b'0', row # clean: nothing to ask at Exit
+ # Its `new` record names it as it is: no +New and a rename.
+ log_now = client.read('/log').decode()
+ assert f'\nnew {made_now} {root}/+Pager\n' in '\n' + log_now, log_now[-400:]
+ assert f'\nrename {made_now} ' not in '\n' + log_now
+ # The directory's one +Pager: the next paged text refills it.
+ fed = subprocess.run([binary, '-'], cwd=root, env=env, input=b'again\r\nprogress 10%\rprogress 100%\n',
+ stdout=subprocess.PIPE, stderr=subprocess.PIPE, timeout=10)
+ assert fed.returncode == 0, fed.stderr
+ assert serials() - before == {made_now}, (serials(), before)
+ assert client.read(f'/pane/{made_now}/body') == b'again\nprogress 100%\n'
client.remove(f'/pane/{made_now}')
+ # From a directory whose name could not be a ctl line: the
+ # session's directory's +Pager, the text whole, no stray +New.
+ odd = root / 'two\nlines'
+ odd.mkdir()
+ fed = subprocess.run([binary, '-'], cwd=odd, env=env, input=b'odd dir text\n',
+ stdout=subprocess.PIPE, stderr=subprocess.PIPE, timeout=10)
+ assert fed.returncode == 0, fed.stderr
+ odd_pane, = serials() - before
+ assert client.read(f'/pane/{odd_pane}/name') == f'{root}/+Pager\n'.encode()
+ assert client.read(f'/pane/{odd_pane}/body') == b'odd dir text\n'
+ client.remove(f'/pane/{odd_pane}')
+ # Nothing on stdin: no pane, and done.
+ fed = subprocess.run([binary, '-'], cwd=root, env=env, input=b'',
+ stdout=subprocess.PIPE, stderr=subprocess.PIPE, timeout=10)
+ assert fed.returncode == 0 and serials() == before, (fed, serials())
# A new name in a directory there but not writable: refused now,
# not a pane that only fails at Save.
shut = root / 'shut-dir'