From 6bcb18e021a09d51539e628106a594748637ead2 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Wed, 4 Nov 2026 16:46:18 -0300 Subject: test: fs.py's inline checks, quic_test, workflow_canary, python_repl_runs_one_line and signal_cleans_up moved to Zig, deleted from fs.py (its named cases stay): 21 process cases in test/process/ (flags: bad options refused in words, --9p naming the socket, forwarding a launch inside a session and the launches that start their own (mount, name, tcp, load, shells, toggle, quic), --wait and its refusals, pardes - and its +Pager (escapes, inks and Filter, progress, 11 MiB, the 256 MiB cut), $winid, the stdin boot, no terminal to draw on, a killed tty editor and its swept sockets, a signal unlinking the socket; mounts: --mount at startup, Mount and Unmount at run time, QUIC and TCP v4 and v6 detached and in a pty (skipped without -Dquic=true, passed with it); tree: the root and /os, 256-byte frames, a held ctl line, a frozen /screen, Look's precedence, 255-byte names; root-ctl: Restore detached and in a pty; builtins: Lspinfo; look-and-exec: the canary; repls: Python's pyrepl) and 3 behaviour tests (a 60 KB body write, truncated, a missing pane refused; a body write's EI record; keyword colour, not bold); process.zig gains, under fsb:, Conn.dialSized, dialTcp, replace, newPane, serials, look, pane, exec, execRefused, removePane, Files.fg, Detached.exists, abs, startTty, and Child (a program in a root's environment, its stdin fed, on a pty if asked, its stderr kept), run, code, entries, canonical, quicIncluded, nowMs, nap, has, check; each checked to fail against a break (no such option reworded, SyntaxBold on by default, a body insert's record not EI, Grep's miss reworded, already inside pardes reworded, a session already running reworded, Lspinfo's servers line reworded, no terminal to draw on reworded, unknown control message reworded); behaviour, process, fs-unit and core tests and the rest of fs.py pass Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge --- test/behaviour/settings.zig | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'test/behaviour/settings.zig') diff --git a/test/behaviour/settings.zig b/test/behaviour/settings.zig index a24a3010..9a14ff50 100644 --- a/test/behaviour/settings.zig +++ b/test/behaviour/settings.zig @@ -269,3 +269,37 @@ test "settings: every on/off setting the root ctl reads flips when its word is w try std.testing.expectEqualStrings("Theme acme", try setting(&s, "Theme")); try std.testing.expectEqualStrings("Shell /bin/sh", try setting(&s, "Shell")); } + +/// A cell's style (one of `Session.styles`) as its bold flag and ink. +fn look(s: *Session, style: []const u8) !struct { bool, []const u8 } { + const a = s.arena.allocator(); + const json = try std.json.parseFromSliceLeaky(std.json.Value, a, style, .{}); + return .{ json.object.get("bold").?.bool, try std.json.Stringify.valueAlloc(a, json.object.get("fg").?, .{}) }; +} + +test "settings: a keyword is coloured apart from the text beside it, and not bold (SyntaxBold is off by default), at a long file's end" { + var s = try Session.initFile(std.testing.allocator, "initial\n"); + defer s.deinit(); + const n = try s.focused(); + try s.write(s.at("/pane/{d}/name", .{n}), "keywords.zig\n"); + var source: std.ArrayList(u8) = .empty; + for (0..9999) |_| try source.appendSlice(s.arena.allocator(), "// padding\n"); + try source.appendSlice(s.arena.allocator(), "fn check() void {\n if (true) return;\n}\n"); + try s.replace(s.at("/pane/{d}/body", .{n}), source.items); + const screen = try s.screen(); + const styles = try s.styles(); + const cols = std.mem.indexOfScalar(u8, screen, '\n').?; + try std.testing.expectEqual(styles.len, cols * (std.mem.count(u8, screen, "\n") + 1)); + for ([_][]const u8{ "fn", "if" }) |word| { + const col, const row = try s.where(s.at("{s} ", .{word})); + const at = row * cols + col; + _, const ink = try look(&s, styles[at]); + for (styles[at..][0..word.len]) |cell| { + const bold, const each = try look(&s, cell); + try std.testing.expect(!bold); + try std.testing.expectEqualStrings(ink, each); + } + _, const plain = try look(&s, styles[at + word.len]); + try std.testing.expect(!std.mem.eql(u8, ink, plain)); + } +} -- cgit v1.3