summaryrefslogtreecommitdiff
path: root/test/behaviour/settings.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-05 23:38:24 -0300
committerGabriel Schneider <[email protected]>2026-11-05 23:58:31 -0300
commit94ca47f225632fefc8f688c0c0822d25d6a5db1e (patch)
tree57a205aead32ad01ae62f3b5b47389d64f58b2af /test/behaviour/settings.zig
parentcd3627307740896426830423598d2e1a8e27b024 (diff)
downloadpardes-94ca47f225632fefc8f688c0c0822d25d6a5db1e.tar.gz
pardes-94ca47f225632fefc8f688c0c0822d25d6a5db1e.zip
settings #6, the cut through the public surface: a T1 case loads the user's startup file (~/.config/pardes/init as it was on 2026-11-05, copied into the test, never read) and finds no init-file notice in /log and every value read back on the root ctl, the window's words as `# X unsupported` in a terminal's view, and a second refuses each of the fifteen cut words on the root ctl with the unknown-word refusal, finds none of them in /commands, and gives a startup file saying one a notice naming its line while the next line still applies (test/session.zig's initStartup); the cut is fifteen of the thirty-two words, Verbose, MessageLinger and DumpDir kept for the tests, harnesses and documented path that use them; a dump the base build wrote with every cut setting off its default Restores in this build; gates on the head: tui core-test 961/961, behaviour-test 242/242, unit-test 1478/1479, pane-test 171/172, snap all 105 scripts ok, process-test 0 of 37 failed, hxdiff 19 and hxparity 6 mismatches (the base's sets by name), hxgolf 0; gui behaviour-test 242/242, unit-test 1522/1523, process-test 0 of 37 failed, gui-golden 0 of 1 failed, monkey-gui 0 of 1 failed; daemon.py main and --window-clients ok; perf within 13% of the base on every medium gesture
Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge
Diffstat (limited to 'test/behaviour/settings.zig')
-rw-r--r--test/behaviour/settings.zig63
1 files changed, 63 insertions, 0 deletions
diff --git a/test/behaviour/settings.zig b/test/behaviour/settings.zig
index 25a3bc04..66cd97df 100644
--- a/test/behaviour/settings.zig
+++ b/test/behaviour/settings.zig
@@ -271,3 +271,66 @@ test "settings: a keyword is coloured apart from the text beside it, and not bol
try std.testing.expect(!std.mem.eql(u8, ink, plain));
}
}
+
+test "settings: the user's startup file loads clean, every word of it known and its value read back" {
+ // ~/.config/pardes/init as it was on 2026-11-05, copied, never read.
+ const init =
+ \\Theme monokai_pro_classic
+ \\# Theme catppuccin_macchiato
+ \\# Theme orchard
+ \\# Theme solarium
+ \\# Theme spectrum
+ \\# Theme doom_one
+ \\GripWidth 110
+ \\CallstackDepth 64
+ \\InactiveDim 5
+ \\Shell fish
+ \\CursorBlink off
+ \\JumpTrail on
+ \\WindowOpacity 100
+ \\Font Go-Mono:18
+ \\# Font JetBrainsMono-Medium:18
+ \\TaglineSize 80
+ \\LocationsConfig context:4 tscontext:on tslocations:on layout:stacked
+ \\
+ \\# Theme neobones_dark
+ \\# Font PaperMono-Regular
+ \\# Font B612Mono-Regular
+ \\# Font Go-Mono
+ \\# Font Hermit-Regular
+ \\# Font IBMPlexMono-Medium
+ \\# Font InputMono-Regular
+ \\# Font InputMonoNarrow-Regular
+ \\# Font JetBrainsMono-Regular
+ \\# Font JuliaMono-Regular
+ \\# Font FantasqueSansMono-Regular
+ \\# Font MartianMono-NrRg:16
+ \\Pet frog
+ \\
+ ;
+ var s = try Session.initStartup(std.testing.allocator, init);
+ defer s.deinit();
+ try std.testing.expect(!has(try s.read("/log"), "init file line"));
+ const ctl = try s.read("/ctl");
+ for ([_][]const u8{ "Theme monokai_pro_classic\n", "CallstackDepth 64\n", "InactiveDim 5\n", "Shell fish\n", "JumpTrail on\n", "LocationsConfig context:4 tscontext:on tslocations:on layout:stacked\n" }) |line| try expectHas(ctl, line);
+ // The window's words, which a terminal's view leaves to the window.
+ const window = @import("pardes_config").platform == .gui;
+ for ([_][2][]const u8{ .{ "GripWidth", "110" }, .{ "CursorBlink", "off" }, .{ "WindowOpacity", "100" }, .{ "TaglineSize", "80" }, .{ "Pet", "frog" } }) |w|
+ try expectHas(ctl, if (window) s.at("\n{s} {s}\n", .{ w[0], w[1] }) else s.at("\n# {s} unsupported\n", .{w[0]}));
+}
+
+test "settings: a word cut from the settings is an unknown word: the root ctl refuses it, /commands has it not, and a startup file saying it gets a notice" {
+ const cut = [_][]const u8{ "Colors", "TreeContextTagStyle", "Tagbottom", "FocusTint", "SyntaxBold", "Ligatures", "Pager", "PagerColor", "TermImages", "SearchPlace", "SearchPane", "SearchRows", "ProgramEsc", "JumpScope", "WindowBlur" };
+ var s = try Session.initFile(std.testing.allocator, "x\n");
+ defer s.deinit();
+ const commands = try s.read("/commands");
+ for (cut) |word| {
+ try std.testing.expectEqual(@as(u16, 22), try s.refused("/ctl", s.at("{s} on\n", .{word})));
+ try std.testing.expectEqualStrings(s.at("unknown control message \"{s}\"", .{word}), s.said);
+ try std.testing.expect(!std.mem.startsWith(u8, commands, s.at("{s} ", .{word})) and !has(commands, s.at("\n{s} ", .{word})));
+ }
+ var t = try Session.initStartup(std.testing.allocator, "Tagbottom on\nWrap off\n");
+ defer t.deinit();
+ try expectHas(try t.read("/log"), "init file line 1: unknown word \"Tagbottom on\"");
+ try std.testing.expect(std.mem.startsWith(u8, try t.read("/ctl"), "Wrap off\n"));
+}