diff options
| author | Gabriel Schneider <[email protected]> | 2026-10-01 17:36:52 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-10-01 17:47:47 -0300 |
| commit | 2dbb047a82523c578cb511058c6e1b745cfc8073 (patch) | |
| tree | 4e03e5e59399a233f7f50f21dd883c707db57f40 /test | |
| parent | 322aff16a2ca0cfd73e1a62234b8904412b30844 (diff) | |
| download | pardes-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')
| -rw-r--r-- | test/fs.py | 26 | ||||
| -rw-r--r-- | test/snapshots/cmdword.snap | 3 | ||||
| -rw-r--r-- | test/snapshots/dirpane.golden | 13 | ||||
| -rw-r--r-- | test/snapshots/dirpane.snap | 27 | ||||
| -rw-r--r-- | test/snapshots/look-dir.snap | 3 | ||||
| -rw-r--r-- | test/snapshots/lookpanes.snap | 3 | ||||
| -rw-r--r-- | test/snapshots/nested.golden | 8 | ||||
| -rw-r--r-- | test/snapshots/ttylook.snap | 3 |
8 files changed, 82 insertions, 4 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) diff --git a/test/snapshots/cmdword.snap b/test/snapshots/cmdword.snap index 631fab8b..42a91e18 100644 --- a/test/snapshots/cmdword.snap +++ b/test/snapshots/cmdword.snap @@ -23,6 +23,9 @@ file zzmark.txt x # the top of the body -- which would move every row this script clicks. The # verbs are what is under test here, not the announcement. config Verbose off +# a directory looked at opens a terminal there (DirLook terminal), as this +# script was written for; DirLook pane, the default, is dirpane.snap's +config DirLook terminal start 31 120 cmds.txt wait 8000 Newcol Joincol wait 8000 cmds.txt diff --git a/test/snapshots/dirpane.golden b/test/snapshots/dirpane.golden new file mode 100644 index 00000000..3118079f --- /dev/null +++ b/test/snapshots/dirpane.golden @@ -0,0 +1,13 @@ +== snap dir-open grid=80x24 cursor=7,6 +|Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit +| New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/dirpane/cwd/top.txt Save Tty Collapse Del +| 1 sub +| +| /tmp/pardes-snap/dirpane/cwd/sub/ Get Tty Collapse Del +| 1 .hidden beta-gamma.txt inner.txt +| 2 alpha.txt deeper/ zeta +| 3 +== snap entry-open grid=80x24 cursor=7,9 +|8: /tmp/pardes-snap/dirpane/cwd/sub/inner.txt Save Tty Collapse Del +|9: 1 inner-marker diff --git a/test/snapshots/dirpane.snap b/test/snapshots/dirpane.snap new file mode 100644 index 00000000..a884b12e --- /dev/null +++ b/test/snapshots/dirpane.snap @@ -0,0 +1,27 @@ +# a look at a directory opens a pane named for it with a trailing /, its +# entries in columns as acme's directory window lays them out: down each +# column first, a directory's marked /, dotfiles shown. A look at an entry +# opens it from that directory. No shell anywhere: nothing here races a prompt. +dirmk sub +dirmk sub/deeper +file sub/inner.txt inner-marker +file sub/.hidden x +file sub/alpha.txt x +file sub/beta-gamma.txt x +file sub/zeta x +file top.txt sub +config Verbose off +start 24 80 top.txt +wait 8000 top.txt +stable 700 20000 +press right @sub 4 +release right @sub 4 +wait 8000 inner.txt +stable 700 20000 +snap dir-open +# an entry, by its name alone: sub's inner.txt +press right @inner.txt 7 +release right @inner.txt 7 +wait 8000 inner-marker +stable 700 20000 +snap entry-open diff --git a/test/snapshots/look-dir.snap b/test/snapshots/look-dir.snap index caf29da8..2032d0c0 100644 --- a/test/snapshots/look-dir.snap +++ b/test/snapshots/look-dir.snap @@ -2,6 +2,9 @@ dirmk sub file sub/inner.txt inner-marker file top.txt x +# a directory looked at opens a terminal there (DirLook terminal), as this +# script was written for; DirLook pane, the default, is dirpane.snap's +config DirLook terminal start 31 100 -n 3 wait 8000 top.txt stable 700 20000 diff --git a/test/snapshots/lookpanes.snap b/test/snapshots/lookpanes.snap index e1db907a..2834a4a9 100644 --- a/test/snapshots/lookpanes.snap +++ b/test/snapshots/lookpanes.snap @@ -24,6 +24,9 @@ file beta/bmark.txt both.txt\nb-marker # the top of the body -- which moves every row this script clicks. What the # verbs do is what is under test, not the announcement. config Verbose off +# a directory looked at opens a terminal there (DirLook terminal), as this +# script was written for; DirLook pane, the default, is dirpane.snap's +config DirLook terminal start 51 130 beta/bmark.txt wait 8000 b-marker stable 700 20000 diff --git a/test/snapshots/nested.golden b/test/snapshots/nested.golden index 07d6148d..44ab4b82 100644 --- a/test/snapshots/nested.golden +++ b/test/snapshots/nested.golden @@ -46,15 +46,15 @@ | | /tmp/pardes-snap/nested/cwd/+New Save Tty Collapse Del | 1 -== snap dir-arg grid=100x31 cursor=4,8 +== snap dir-arg grid=100x31 cursor=7,6 |Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit | New Tty Find Grep Joincol Delcol |$ /tmp/pardes-snap/nested/cwd Tty+bash Save Mode Filter Collapse Del | $ $(readlink /proc/$PPID/exe) nestdir | $ -| /tmp/pardes-snap/nested/cwd/nestdir Tty+bash Save Mode Filter Collapse Del -| ls -| inside-nested.txt +| /tmp/pardes-snap/nested/cwd/nestdir/ Get Tty Collapse Del +| 1 inside-nested.txt +| 2 | | | diff --git a/test/snapshots/ttylook.snap b/test/snapshots/ttylook.snap index 5b82bd89..91401a64 100644 --- a/test/snapshots/ttylook.snap +++ b/test/snapshots/ttylook.snap @@ -9,6 +9,9 @@ lines big.txt 40 file plain.txt just text dirmk sub +# a directory looked at opens a terminal there (DirLook terminal), as this +# script was written for; DirLook pane, the default, is dirpane.snap's +config DirLook terminal start 31 120 -n 3 wait 8000 big.txt stable 700 20000 |
