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.zig33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/ninep/ctl.zig b/src/ninep/ctl.zig
index 59a80f36..5bf354eb 100644
--- a/src/ninep/ctl.zig
+++ b/src/ninep/ctl.zig
@@ -1752,6 +1752,39 @@ test "a look after Newcol fills the empty column the keyboard is on" {
try testing.expectEqual(p.active, p.col_panes[p.ncol - 1][0]);
}
+test "a look at file:addr whose file is not there is one miss, quoting what was written, in a terminal too" {
+ const p = try th.withTerm(testing.allocator);
+ defer p.deinit();
+ const looked = Node.of(serialOf(p), .look);
+ for ([_][]const u8{ "zzq:#3", "zzq:2", "zzq:/re/" }) |written| {
+ var line: [64]u8 = undefined;
+ _ = wr(p, looked, try std.fmt.bufPrint(&line, "{s}\n", .{written}));
+ var want: [64]u8 = undefined;
+ try testing.expectEqual(@as(usize, 1), th.logCount(p, try std.fmt.bufPrint(&want, "look: no match for \"{s}\"\n", .{written})));
+ }
+ try testing.expectEqual(@as(usize, 3), th.logCount(p, "\nerr "));
+}
+
+test "a look whose pane is refused a place fails with that alone, not a missing line too" {
+ const gpa = testing.allocator;
+ // A screen with rows for one pane only.
+ const p = try Pardes.init(gpa, .{ .tty_only = true, .cols = 80, .rows = 5 });
+ defer p.deinit();
+ while (p.nextEffect()) |_| {}
+ _ = try p.setTestFile("x\n");
+ while (p.nextEffect()) |_| {}
+ var tmp = testing.tmpDir(.{});
+ defer tmp.cleanup();
+ try tmp.dir.writeFile(testing.io, .{ .sub_path = "f.txt", .data = "one\ntwo\n" });
+ var dir: [4096]u8 = undefined;
+ const at = dir[0..try tmp.dir.realPath(testing.io, &dir)];
+ var line: [4200]u8 = undefined;
+ const r = wr(p, root_look, try std.fmt.bufPrint(&line, "{s}/f.txt:2\n", .{at}));
+ try testing.expectEqual(Status.err, r.reply.status);
+ try testing.expect(std.mem.indexOf(u8, r.reply.ename, "no space for a pane") != null);
+ try testing.expectEqual(@as(usize, 1), th.logCount(p, "\nerr "));
+}
+
test "a look under pardes's placement, from a pane pane/new made after Delcol, opens its file" {
const gpa = testing.allocator;
const p = try withFile(gpa, "x\n");