diff options
Diffstat (limited to 'test/fs.py')
| -rw-r--r-- | test/fs.py | 26 |
1 files changed, 26 insertions, 0 deletions
@@ -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) |
