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.zig85
1 files changed, 0 insertions, 85 deletions
diff --git a/src/ninep/ctl.zig b/src/ninep/ctl.zig
index 37f27dac..69a0e791 100644
--- a/src/ninep/ctl.zig
+++ b/src/ninep/ctl.zig
@@ -1681,22 +1681,6 @@ test "Edit through a pane's ctl renames every foo in one undo step, and a failed
try testing.expectEqualStrings("foo x foo y foo\n", rd(p, body, 0, 64).bytes);
}
-test "a write of an Edit block carries it whole, to a pane's ctl, the root's ctl and exec" {
- const p = try withFile(testing.allocator, "foo x\nfoo y\n");
- defer p.deinit();
- const serial = serialOf(p);
- const body = Node.of(serial, .body);
- try testing.expectEqual(Status.ok, wr(p, Node.of(serial, .ctl), "Edit ,x/foo/{\ni/[/\na/]/\n}\n").reply.status);
- try testing.expectEqualStrings("[foo] x\n[foo] y\n", rd(p, body, 0, 64).bytes);
- p.active = p.paneBySerial(serial).?;
- try testing.expectEqual(Status.ok, wr(p, @backingInt(tree.TopFile.ctl), "Edit ,x/\\[/{\nc/</\n}\n").reply.status);
- try testing.expectEqualStrings("<foo] x\n<foo] y\n", rd(p, body, 0, 64).bytes);
- try testing.expectEqual(Status.ok, wr(p, Node.of(serial, .exec), "Edit $a\nend\n.\n").reply.status);
- try testing.expectEqualStrings("<foo] x\n<foo] y\nend\n", rd(p, body, 0, 64).bytes);
- // An unclosed group is refused, and nothing after it runs as a line.
- try testing.expectEqual(E.IO, wr(p, Node.of(serial, .ctl), "Edit ,x/foo/{\nd\n").errno());
- try testing.expectEqualStrings("<foo] x\n<foo] y\nend\n", rd(p, body, 0, 64).bytes);
-}
test "dirty goes back to 0 when the text is the saved text again" {
const p = try withFile(testing.allocator, "one\n");
@@ -2012,24 +1996,6 @@ test "Get reads the pane's file again, refusing unsaved edits once, and Get file
try testing.expect(!pane_files.dirtyOf(pane));
}
-test "Putall saves every pane with unsaved edits to a file, one each, and leaves the rest" {
- const p = try withFile(testing.allocator, "x\n");
- defer p.deinit();
- const first = serialOf(p);
- _ = wr(p, Node.of(first, .name), "/tmp/pardes-putall-a.txt\n");
- _ = wr(p, Node.of(first, .body), "edited\n");
- const second = p.freeSlot().?;
- _ = try p.newDocPane(second);
- p.panes[second].?.file = .{ .path = try p.gpa.dupe(u8, "/tmp/pardes-putall-b.txt"), .content = try p.gpa.dupe(u8, "clean\n"), .history = try panes.File.History.create(p.gpa) };
- while (p.nextEffect()) |_| {}
- try testing.expect(p.executeBuiltinLine(0, "Putall"));
- var saves: usize = 0;
- while (p.nextEffect()) |e| if (e == .save_file) {
- saves += 1;
- try testing.expectEqual(@as(u16, 0), e.save_file.pane);
- };
- try testing.expectEqual(@as(usize, 1), saves);
-}
test "Zerox makes a second pane on one buffer: one text, undo and dirty state, its own cursor; Save cleans both, Del of one asks nothing" {
var tmp = testing.tmpDir(.{});
@@ -3690,16 +3656,6 @@ test "a line starting with # runs as nothing at an exec or a ctl, silently" {
try testing.expectEqualStrings(log_before.bytes, log_after.bytes);
}
-test "the ctl word name refuses a leading blank, as the name file does" {
- const p = try withFile(testing.allocator, "x\n");
- defer p.deinit();
- const serial = serialOf(p);
- const r = wr(p, Node.of(serial, .ctl), "name /tmp/lead.txt\n");
- try testing.expectEqual(E.INVAL, r.errno());
- try testing.expectEqualStrings("bad character in file name: a blank at its start", r.reply.ename);
- try testing.expectEqual(Status.ok, wr(p, Node.of(serial, .ctl), "name /tmp/ok.txt\n").reply.status);
- try testing.expectEqualStrings("/tmp/ok.txt", pane_files.nameOf(p, p.panes[0].?));
-}
test "a builtin that takes no argument, written with one to an exec, is refused wrong #args, as at a ctl" {
const p = try withFile(testing.allocator, "x\n");
@@ -5042,15 +4998,6 @@ test "Lspinfo's answer is the +Lsp pane it fills, as a Rename preview's is its +
try testing.expect(std.mem.endsWith(u8, p.panes[shown].?.file.?.path, "+Lsp"));
}
-test "a collapsed pane's ctl says so" {
- const p = try withFile(testing.allocator, "x\n");
- defer p.deinit();
- _ = try th.newPane(p);
- const id = p.paneBySerial(serialOf(p)).?;
- layout.toggleCollapse(p, id);
- try testing.expect(p.panes[id].?.collapsed);
- try testing.expect(std.mem.endsWith(u8, rd(p, Node.of(serialOf(p), .ctl), 0, 4096).bytes, " collapsed "));
-}
test "a look of ./x that is not there is a miss, as x and /abs/x are: answered, the err logged" {
const p = try withFile(testing.allocator, "x\n");
@@ -5180,35 +5127,3 @@ test "the init file saved in a pane applies its settings again, and runs none of
try testing.expectEqualStrings("acme", p.theme().name);
try testing.expectEqual(cols, p.ncol);
}
-
-test "kbdin types at the pane with the keyboard and mousein clicks, as a user would, each done before its write is answered" {
- const p = try withFile(testing.allocator, "x\n");
- defer p.deinit();
- const s = serialOf(p);
- const kbdin = @backingInt(tree.TopFile.kbdin);
- const mousein = @backingInt(tree.TopFile.mousein);
- const body = Node.of(s, .body);
- try testing.expectEqual(@as(u16, 0), wr(p, kbdin, "ihello \x1b").errno());
- try testing.expectEqualStrings("hello x\n", rd(p, body, 0, 64).bytes);
- // Plan 9's Khome rune, then text before it.
- try testing.expectEqual(@as(u16, 0), wr(p, kbdin, "A!\x1b\u{F00D}i>\x1b").errno());
- try testing.expectEqualStrings(">hello x!\n", rd(p, body, 0, 64).bytes);
- // A left click on the second l, then text there; where it is, as a
- // client reads it off /screen, from a frame drawn.
- var frame: std.heap.ArenaAllocator = .init(p.gpa);
- defer frame.deinit();
- _ = try p.render(frame.allocator());
- const id = p.paneBySerial(s).?;
- const pane = p.panes[id].?;
- const r = p.rects[id];
- var line: [64]u8 = undefined;
- const at = .{ r.x + config.GUTTER + panes.File.gutterWidth(pane) + 4, p.bodyTop(pane, r) };
- try testing.expectEqual(@as(u16, 0), wr(p, mousein, try std.fmt.bufPrint(&line, "m {d} {d} 1\nm {d} {d} 0\n", at ++ at)).errno());
- try testing.expectEqual(@as(u16, 0), wr(p, kbdin, "i#\x1b").errno());
- try testing.expectEqualStrings(">hel#lo x!\n", rd(p, body, 0, 64).bytes);
- // Refused, in words, as rio and devmouse refuse.
- try testing.expectEqual(E.INVAL, wr(p, mousein, "m 1 2\n").errno());
- try testing.expectEqual(E.INVAL, wr(p, mousein, "x 1 2 0\n").errno());
- try testing.expectEqual(E.INVAL, wr(p, kbdin, "\xff").errno());
- try testing.expectEqual(E.PERM, rd(p, kbdin, 0, 64).errno());
-}