summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/fs.py13
-rw-r--r--test/fs_bench.zig5
2 files changed, 15 insertions, 3 deletions
diff --git a/test/fs.py b/test/fs.py
index fe7e4c13..ccf3eb89 100644
--- a/test/fs.py
+++ b/test/fs.py
@@ -234,6 +234,17 @@ def discovery(binary, embedded=False):
assert locked, 'a lock waiting on another open goes once it unlocks'
client.close(mine)
other.close(theirs)
+ # /focus names the pane with the keyboard and moves it, as rio's
+ # wctl `current` does; a pane's ctl line ends saying which it is.
+ client.write('/focus', f'{first}\n'.encode())
+ assert client.read('/focus') == f'{first}\n'.encode()
+ assert client.read(f'/pane/{first}/ctl').endswith(b' current ')
+ assert client.read(f'/pane/{second}/ctl').endswith(b' notcurrent ')
+ try:
+ client.write('/focus', b'99999\n')
+ raise AssertionError('focus took a serial no pane has')
+ except OSError as refused:
+ assert 'no such window' in str(refused), refused
assert set(client.list('/pane')) == {'new', str(fixture), str(first), str(second)}
client.write(f'/pane/{first}/body', b'first pane', truncate=True)
assert client.read(f'/pane/{first}/body') == b'first pane'
@@ -304,7 +315,7 @@ def discovery(binary, embedded=False):
assert client.read('/src/pardes.zig').startswith(b'const std')
assert client.stat('/src/pardes.zig')['mode'] == 0o444
assert b'pub const Pardes' in client.read(f'/pane/{look(client, "/virtual/src/pardes.zig")}/body')
- print('9P discovery: listing/stat/find are inert; new, remove, look, exec, name, sel, log and ctl lock behave')
+ print('9P discovery: listing/stat/find are inert; new, remove, look, exec, name, sel, log, ctl lock and focus behave')
def run_file(binary):
diff --git a/test/fs_bench.zig b/test/fs_bench.zig
index da9da47c..75b2eb11 100644
--- a/test/fs_bench.zig
+++ b/test/fs_bench.zig
@@ -123,7 +123,8 @@ fn checkReply(s: *Session, req: ctlfs.Req, reply: ctlfs.Reply) !void {
if (req.node == s.node(.ctl)) {
const tail = try checkNumbers(rest, &.{pane.cols});
if (!std.mem.startsWith(u8, tail, "default ")) return error.IncorrectReply;
- if ((try checkNumbers(tail[8..], &.{pardes.config.tab_width})).len != 0)
+ const current = try checkNumbers(tail[8..], &.{pardes.config.tab_width});
+ if (!std.mem.eql(u8, current, "current ") and !std.mem.eql(u8, current, "notcurrent "))
return error.IncorrectReply;
} else return error.UnmeasuredOperation;
}
@@ -143,7 +144,7 @@ fn checkReply(s: *Session, req: ctlfs.Req, reply: ctlfs.Reply) !void {
const size: usize = bytes[off + 9];
off += 10;
if (dir > 1 or size == 0 or size > bytes.len - off) return error.IncorrectReply;
- if (entry < names.len and (node != nodes[entry] or dir != @intFromBool(entry >= 7) or
+ if (entry < names.len and (node != nodes[entry] or dir != @intFromBool(entry >= 8) or
!std.mem.eql(u8, names[entry], bytes[off..][0..size]))) return error.IncorrectReply;
off += size;
}