summaryrefslogtreecommitdiff
path: root/test/behaviour/settings.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-04 10:52:24 -0300
committerGabriel Schneider <[email protected]>2026-11-04 10:56:17 -0300
commit350e7cc22b85130cbe95a114c668945b1dc12fd7 (patch)
tree26454697f244051bb3b616cb7810e3dcade54eeb /test/behaviour/settings.zig
parentb798f2c1cf5dd4f98c8c1f81c8642b005890f6ee (diff)
downloadpardes-350e7cc22b85130cbe95a114c668945b1dc12fd7.tar.gz
pardes-350e7cc22b85130cbe95a114c668945b1dc12fd7.zip
test: twenty-two more of src/ninep/ctl.zig's tests through the 9P tree alone: in test/behaviour/look_and_exec.zig a look opening a spaced path at its line and column leaving the source as it was, a batch validated whole before any virtual file opens, /status's lines, mode and refusal with look and exec validating batches and reading back their panes, a look at a file it may not read, a trailing colon dropped and a failed address opening nothing, a file:/re/ miss logged as its file's pane, a look into another pane leaving the source's dot, a word looked for in its own pane (wrapping, then LookWord list's +Search), a second LookWord list look refilling its +Search, @pN: and a line past the end said one way, an exec over the command limit, a builtin failing through exec, tagexec and a column's exec with one err and no msg, and Look . from a gone directory; in rules.zig every EINVAL's words, the log's too; in limits.zig a ctl line over 1 MiB refused once; in panes.zig acme's ctl words and +Unsaved dropping a closed pane's row; in the new from_acme.zig Put, Delete and acme's words refused; in settings.zig GUI-only settings and DumpDir read back; in root_ctl.zig Joincol and Theme's refusals and a theme's name in any case; in placement.zig a look from a pane made after Delcol placed in a column; in edit.zig Edit ,p logged with no room for +Errors; the status test kept for its window's pointer line, and Joincol's for themesNear's unit checks, each trimmed; each checked to fail against a break (status's pane count, a look's open failure words, the trailing colon kept, e_no_match, the empty name's words, the 1 MiB cap doubled, acme's Put renamed, the GUI-only words, themeIndex by case, command_max 1023, a repeat counted by two, Look .'s no such directory words, dropUnsaved doing nothing, lookWord not wrapping, limit=addr not taking, Edit's text not logged when unplaced, @pN: with no address a miss, a look into another pane clearing the source's dot, a column taken as the cursor's, the batch's control-character check and command's checking pass both skipped, LookWord's +Search never shared, atFoot placing nothing)
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge
Diffstat (limited to 'test/behaviour/settings.zig')
-rw-r--r--test/behaviour/settings.zig20
1 files changed, 20 insertions, 0 deletions
diff --git a/test/behaviour/settings.zig b/test/behaviour/settings.zig
index b850a532..f3ed57de 100644
--- a/test/behaviour/settings.zig
+++ b/test/behaviour/settings.zig
@@ -112,3 +112,23 @@ test "settings: a bad setting value is quoted, so two different bad values log a
try std.testing.expect(has(log, "takes on, off \"nope\"\n"));
try std.testing.expect(!has(log, "(x2)"));
}
+
+test "settings: a setting this frontend cannot show says GUI-only, never run as a command, and DumpDir reads back" {
+ var s = try Session.initFile(std.testing.allocator, "x\n");
+ defer s.deinit();
+ if (comptime @import("pardes_config").platform != .gui) {
+ _ = try s.refused("/ctl", "Lift on\n");
+ try std.testing.expectEqualStrings("Lift is GUI-only, invalid here \"Lift\"", s.said);
+ _ = try s.refused("/ctl", "GripWidth 120\n");
+ try std.testing.expectEqualStrings("GripWidth is GUI-only, invalid here \"GripWidth\"", s.said);
+ // A builtin the GUI alone has, written to a ctl or an exec, never
+ // runs as a shell command.
+ _ = try s.refused("/ctl", "Fonts\n");
+ try std.testing.expectEqualStrings("Fonts is GUI-only, invalid here \"Fonts\"", s.said);
+ try std.testing.expectEqual(@as(u16, 22), try s.refused("/exec", "Fonts\n"));
+ try std.testing.expectEqualStrings("Fonts is GUI-only, invalid here", s.said);
+ }
+ _ = try s.refused("/ctl", "Liftt on\n");
+ try std.testing.expectEqualStrings("unknown control message \"Liftt\"", s.said);
+ try std.testing.expect(has(try s.read("/ctl"), "\nDumpDir /"));
+}