diff options
Diffstat (limited to 'test/behaviour/settings.zig')
| -rw-r--r-- | test/behaviour/settings.zig | 20 |
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 /")); +} |
