From a0320c49c1288e8e74f18983f18988a024952bb8 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Tue, 3 Nov 2026 16:38:06 -0300 Subject: test: four more of src/ninep/ctl.zig's tests through the 9P tree alone (test/behaviour/look_and_exec, columns_and_tags, root_ctl): a look's leading blanks and exec's trim, a bare :N look from a pane's look, the root's and an event write-back (dot read from the dot file), a look after Newcol (the column read from /layout), size of a detached session (the screen read from /screen); Session's range and detach; each checked to fail against a break (a look's blanks trimmed, size taking a screen too small for its panes) Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge --- test/session.zig | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'test/session.zig') diff --git a/test/session.zig b/test/session.zig index 28557322..8b3c5c41 100644 --- a/test/session.zig +++ b/test/session.zig @@ -120,6 +120,17 @@ pub const Session = struct { return out.items; } + /// A range file (`dot`, `addr`, `limit`) as its two offsets. + pub fn range(s: *Session, path: []const u8) !struct { u32, u32 } { + var it = std.mem.tokenizeScalar(u8, try s.read(path), ' '); + return .{ try std.fmt.parseInt(u32, it.next() orelse return error.NoRange, 10), try std.fmt.parseInt(u32, it.next() orelse return error.NoRange, 10) }; + } + + /// No frontend attached, as a detached session's daemon says. + pub fn detach(s: *Session) void { + pardesOf(s).unattended = true; + } + /// The serial of the pane with the keyboard. pub fn focused(s: *Session) !u32 { return std.fmt.parseInt(u32, std.mem.trim(u8, try s.read("/focus"), "\n"), 10); -- cgit v1.3