summaryrefslogtreecommitdiff
path: root/test/behaviour
diff options
context:
space:
mode:
Diffstat (limited to 'test/behaviour')
-rw-r--r--test/behaviour/settings.zig25
1 files changed, 25 insertions, 0 deletions
diff --git a/test/behaviour/settings.zig b/test/behaviour/settings.zig
index 3a9d42df..d87e8191 100644
--- a/test/behaviour/settings.zig
+++ b/test/behaviour/settings.zig
@@ -43,6 +43,31 @@ test "settings: Shell refuses a path that is no executable, and bare it goes bac
try std.testing.expectEqualStrings(default, try setting(&s, "Shell"));
}
+test "settings: Pet is the window's: a terminal's view refuses it; a window takes only its pets, and /ctl reads it back" {
+ var s = try Session.initFile(std.testing.allocator, "x\n");
+ defer s.deinit();
+ // Which build, from its options, not from the answer: a terminal's view
+ // taking Pet must fail here, not pass as a window.
+ if (comptime @import("pardes_config").platform == .gui) {
+ try std.testing.expectEqualStrings("Pet off", try setting(&s, "Pet"));
+ try s.write("/ctl", "Pet cat\n");
+ try std.testing.expectEqualStrings("Pet cat", try setting(&s, "Pet"));
+ // A window's: dog is no pet of its.
+ _ = try s.refused("/ctl", "Pet dog\n");
+ try std.testing.expectEqualStrings("Pet cat", try setting(&s, "Pet"));
+ try s.write("/ctl", "Pet frog\n");
+ try std.testing.expectEqualStrings("Pet frog", try setting(&s, "Pet"));
+ try s.write("/ctl", "Pet off\n");
+ try std.testing.expectEqualStrings("Pet off", try setting(&s, "Pet"));
+ return;
+ }
+ _ = try s.refused("/ctl", "Pet cat\n");
+ try std.testing.expectEqualStrings("Pet is GUI-only, invalid here \"Pet\"", s.said);
+ try std.testing.expectEqual(@as(u16, 22), try s.refused(s.at("/pane/{d}/exec", .{try s.focused()}), "Pet cat\n"));
+ try std.testing.expectEqualStrings("Pet is GUI-only, invalid here", s.said);
+ try std.testing.expect(has(try s.read("/ctl"), "\n# Pet unsupported\n"));
+}
+
fn expectHas(text: []const u8, part: []const u8) !void {
if (std.mem.indexOf(u8, text, part) == null) {
std.debug.print("not in it: {s}\n", .{part});