summaryrefslogtreecommitdiff
path: root/test/fs.py
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-10-01 17:36:52 -0300
committerGabriel Schneider <[email protected]>2026-10-01 17:47:47 -0300
commit2dbb047a82523c578cb511058c6e1b745cfc8073 (patch)
tree4e03e5e59399a233f7f50f21dd883c707db57f40 /test/fs.py
parent322aff16a2ca0cfd73e1a62234b8904412b30844 (diff)
downloadpardes-2dbb047a82523c578cb511058c6e1b745cfc8073.tar.gz
pardes-2dbb047a82523c578cb511058c6e1b745cfc8073.zip
A look at a directory opens a pane listing it, as acme's directory window: named dir/, its entries in acme's columns (bytewise, dotfiles kept, a directory's marked /), a look at an entry from there, Get or a look again reads it again, never dirty, Save refused; DirLook terminal keeps ls in a terminal
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'test/fs.py')
-rw-r--r--test/fs.py26
1 files changed, 26 insertions, 0 deletions
diff --git a/test/fs.py b/test/fs.py
index 204f4b37..65b354d9 100644
--- a/test/fs.py
+++ b/test/fs.py
@@ -605,6 +605,28 @@ def unattended_messages_expire(binary):
assert not shown(), 'an unattended message outlived MessageLinger'
+def directory_panes(binary):
+ """A look at a directory opens a pane listing it, as acme's directory
+ window: a text pane named with a trailing /, its body the entries (a
+ directory's marked /), ctl's isdir 1, and get reads it again."""
+ with tempfile.TemporaryDirectory(prefix='pardes-dirpane-') as directory:
+ root = Path(directory).resolve()
+ listed = root / 'listed'
+ (listed / 'sub').mkdir(parents=True)
+ (listed / '.dot').write_bytes(b'')
+ with session(binary, root, 'dirpane') as (client, _):
+ serial = look(client, str(listed))
+ rows = [row.split() for row in client.read('/index').decode().splitlines()]
+ row = next(r for r in rows if int(r[0]) == serial)
+ assert row[1:4] == ['text', '0', f'{listed}/'], row
+ body = client.read(f'/pane/{serial}/body').decode()
+ assert body.split() == ['.dot', 'sub/'], body
+ assert client.read(f'/pane/{serial}/ctl').split()[3] == b'1'
+ (listed / 'later').write_bytes(b'')
+ client.write(f'/pane/{serial}/ctl', b'get\n')
+ assert client.read(f'/pane/{serial}/body').decode().split() == ['.dot', 'later', 'sub/']
+
+
def new_terminals_named_once(binary):
"""A terminal started outside the session's directory is named by that
directory from its `new` on: no rename to the session's and back."""
@@ -612,6 +634,9 @@ def new_terminals_named_once(binary):
root = Path(directory)
(root / 'sub').mkdir()
with session(binary, root, 'names') as (client, _):
+ # A look at a directory starts a terminal there (DirLook
+ # terminal); DirLook pane, the default, lists it in a pane.
+ client.write('/ctl', b'DirLook terminal\n')
made = [look(client, str(root / 'sub'))]
before = {int(row.split()[0]) for row in client.read('/index').splitlines()}
client.write('/pane/1/ctl', b'Tty\n')
@@ -992,6 +1017,7 @@ def test(binary, quic=False):
exit_answers(binary)
unattended_messages_expire(binary)
new_terminals_named_once(binary)
+ directory_panes(binary)
workflow_canary(binary)
recent_survives_restart(binary)
python_repl_runs_one_line(binary)