summaryrefslogtreecommitdiff
path: root/src/ninep
diff options
context:
space:
mode:
Diffstat (limited to 'src/ninep')
-rw-r--r--src/ninep/ctl.zig30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/ninep/ctl.zig b/src/ninep/ctl.zig
index ae68ed91..274caf88 100644
--- a/src/ninep/ctl.zig
+++ b/src/ninep/ctl.zig
@@ -2025,6 +2025,36 @@ test "Zerox twins dump their text once and come back on one buffer from a Restor
try testing.expect(std.mem.startsWith(u8, files[0].content, "one\ntwo\nunsaved "));
}
+test "a bad Tab width and a bad Incl directory are refused invalid, changing nothing; a twin's rename is each twin's" {
+ defer config.tab_now = config.tab_width;
+ const p = try withFile(testing.allocator, "x\n");
+ defer p.deinit();
+ const root_ctl = @intFromEnum(tree.TopFile.ctl);
+ for ([_][]const u8{ "Tab 0\n", "Tab 17\n", "Tab x\n" }) |line| {
+ try testing.expectEqual(E.INVAL, wr(p, root_ctl, line).errno());
+ // Run from a pane, as a tag click runs it: said invalid too.
+ const r = wr(p, Node.of(serialOf(p), .exec), line);
+ try testing.expectEqual(E.INVAL, r.errno());
+ try testing.expect(std.mem.indexOf(u8, r.reply.ename, "invalid tab width") != null);
+ }
+ try testing.expectEqual(config.tab_width, config.tab_now);
+ const before = p.incl.items.len;
+ try testing.expectEqual(E.INVAL, wr(p, root_ctl, "Incl rel/dir\n").errno());
+ try testing.expectEqual(E.INVAL, wr(p, root_ctl, "Incl - /usr/include\n").errno());
+ if (comptime pardes.hosted) try testing.expectEqual(E.NOENT, wr(p, root_ctl, "Incl /tmp/pardes-surely-no-such-dir\n").errno());
+ try testing.expectEqual(before, p.incl.items.len);
+ // A twin renamed: a rename record for each.
+ const first = serialOf(p);
+ try testing.expect(p.executeBuiltinLine(0, "Zerox"));
+ const twin = for (p.panes) |slot| {
+ if (slot) |pane| if (pane.serial != first and pane.file != null) break pane.serial;
+ } else return error.NoTwin;
+ _ = wr(p, Node.of(first, .name), "/tmp/pardes-twin-renamed.txt\n");
+ var rec: [64]u8 = undefined;
+ try testing.expect(th.logHas(p, try std.fmt.bufPrint(&rec, "rename {d} /tmp/pardes-twin-renamed.txt\n", .{first})));
+ try testing.expect(th.logHas(p, try std.fmt.bufPrint(&rec, "rename {d} /tmp/pardes-twin-renamed.txt\n", .{twin})));
+}
+
test "a body write to a terminal is typed input, not a paste, even to a program that asked for bracketed paste" {
const p = try Pardes.init(testing.allocator, .{ .cols = 90, .rows = 30 });
defer p.deinit();