//! docs/typ/reference.typ, Settings . const std = @import("std"); const Session = @import("session").Session; test "settings: Pet is the window's: a terminal's view refuses it, from a pane and the root; a window takes only its pets" { 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 s.write("/ctl", "Pet cat\n"); // A window's: dog is no pet of its, and off is. try std.testing.expect(std.mem.indexOf(u8, try s.read("/ctl"), "\nPet cat\n") != null); _ = try s.refused("/ctl", "Pet dog\n"); try std.testing.expect(std.mem.indexOf(u8, try s.read("/ctl"), "\nPet cat\n") != null); try s.write("/ctl", "Pet frog\n"); try std.testing.expect(std.mem.indexOf(u8, try s.read("/ctl"), "\nPet frog\n") != null); try s.write("/ctl", "Pet off\n"); try std.testing.expect(std.mem.indexOf(u8, try s.read("/ctl"), "\nPet off\n") != null); return; } try std.testing.expectEqual(@as(u16, 22), try s.refused("/ctl", "Pet cat\n")); try std.testing.expect(std.mem.startsWith(u8, s.said, "Pet is GUI-only, invalid here")); 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(std.mem.indexOf(u8, try s.read("/ctl"), "Pet ") == null); }