summaryrefslogtreecommitdiff
path: root/src/ninep/ctl.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/ninep/ctl.zig')
-rw-r--r--src/ninep/ctl.zig11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/ninep/ctl.zig b/src/ninep/ctl.zig
index e0c4b21b..87339b70 100644
--- a/src/ninep/ctl.zig
+++ b/src/ninep/ctl.zig
@@ -1812,6 +1812,17 @@ test "a look at a file it may not read fails the write naming the file" {
try testing.expectEqualStrings(expected, refused.reply.ename);
}
+test "Pager is a setting of the root ctl: pardes by default, off taken, anything else refused with its choices" {
+ const p = try withFile(testing.allocator, "x\n");
+ defer p.deinit();
+ const root_ctl = @intFromEnum(tree.TopFile.ctl);
+ try testing.expect(std.mem.indexOf(u8, rd(p, root_ctl, 0, 1 << 16).bytes, "Pager pardes\n") != null);
+ try testing.expectEqual(Status.ok, wr(p, root_ctl, "Pager off\n").reply.status);
+ try testing.expectEqual(config.Runtime.Pager.off, p.settings.pager);
+ try testing.expect(std.mem.indexOf(u8, rd(p, root_ctl, 0, 1 << 16).bytes, "Pager off\n") != null);
+ try testing.expectEqualStrings("bad value in control message; takes pardes, off \"Pager\"", wr(p, root_ctl, "Pager less\n").reply.ename);
+}
+
test "a refused Del written back through event fails that write, EIO, with its err" {
const gpa = testing.allocator;
const p = try withFile(gpa, "text\n");