diff options
| author | Gabriel Schneider <[email protected]> | 2026-09-28 10:26:47 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-10-01 00:12:14 -0300 |
| commit | 60e40675c82efd17aa6bf31bc66c3f8f3f918360 (patch) | |
| tree | 1be23a1372c7383a2d37fe82ea6e8af9b91f488c /test | |
| parent | d9c6786e19567878e3c89ae212296ce941484096 (diff) | |
| download | pardes-60e40675c82efd17aa6bf31bc66c3f8f3f918360.tar.gz pardes-60e40675c82efd17aa6bf31bc66c3f8f3f918360.zip | |
Addresses search a line at a time as sam does, say why they fail, and a failed addr leaves no address
addr's regexps ran mvzr over text[from..hi]: ^ and $ anchored only at the
slice's ends, . matched newlines, the search never wrapped, and every
failure read as bad address syntax. The regexps stay mvzr's, called the
way sam searches (editors/acme/regx.c): one line per haystack, so ^ and $
fall at line boundaries and . never crosses a newline; a pattern naming
\\n runs over the whole text with its . made [^\\n]; /re/ wraps unless
limit is set, and ?re? takes the last match before the range. The ceiling
(mvzr's first alternative, not sam's longest) is documented. A failed
address says why (no match for regexp, address out of range, bad regular
expression), and a failed write to addr leaves no address, so data and
xdata refuse until the next good one instead of writing at the old range.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'test')
| -rw-r--r-- | test/fs.py | 12 |
1 files changed, 12 insertions, 0 deletions
@@ -344,6 +344,18 @@ def discovery(binary, embedded=False): client.write(f'/pane/{scratch}/addr', b'#0,#5') client.write(f'/pane/{scratch}/data', b'HOWDY', truncate=True) assert client.read(f'/pane/{scratch}/body') == b'HOWDY world\nsecond line\n' + # sam's regexps: ^ at any line; a miss says so and leaves no + # address, so the data write after it refuses. + client.write(f'/pane/{scratch}/addr', b'/^second/') + assert client.read(f'/pane/{scratch}/addr') == b' 12 18 ' + for path, data, why in ((f'/pane/{scratch}/addr', b'/nowhere/', 'no match for regexp'), + (f'/pane/{scratch}/data', b'LOST', 'no address')): + try: + client.write(path, data) + raise AssertionError(f'{path} took {data!r}') + except OSError as refused: + assert why in str(refused), refused + assert client.read(f'/pane/{scratch}/body') == b'HOWDY world\nsecond line\n' client.remove(f'/pane/{scratch}') print('9P discovery: listing/stat/find are inert; new, remove, look, exec, name, sel, log, ctl lock, focus, the ctl split and commands behave') |
