diff options
Diffstat (limited to 'core/ninep')
| -rw-r--r-- | core/ninep/ctl.zig | 12 | ||||
| -rw-r--r-- | core/ninep/events.zig | 14 | ||||
| -rw-r--r-- | core/ninep/tree.zig | 5 |
3 files changed, 21 insertions, 10 deletions
diff --git a/core/ninep/ctl.zig b/core/ninep/ctl.zig index 84f3ba6b..637999c2 100644 --- a/core/ninep/ctl.zig +++ b/core/ninep/ctl.zig @@ -1747,6 +1747,8 @@ test "a look whose pane is refused a place fails with that alone, not a missing // A screen with rows for one pane only. const p = try Pardes.init(gpa, .{ .tty_only = true, .cols = 80, .rows = 5 }); defer p.deinit(); + // About a jump opening a pane: `Jumps new-pane` (SPEC §6.6). + p.settings.jumps = .@"new-pane"; while (p.nextEffect()) |_| {} _ = try p.setTestFile("x\n"); while (p.nextEffect()) |_| {} @@ -2055,7 +2057,7 @@ test "a language server question that finds nothing, cannot be answered, or is a _ = wr(p, root_exec, "Recent\n"); const listed = p.paneBySerial(try std.fmt.parseInt(u32, std.mem.trimEnd(u8, rd(p, root_exec, 0, 64).bytes, "\n"), 10)).?; p.lspRequest(listed, .incoming_calls, ""); - try testing.expect(std.mem.indexOf(u8, p.panes[listed].?.msg[0..p.panes[listed].?.msg_len], "Callers: only a file's pane asks") != null); + try testing.expect(std.mem.indexOf(u8, p.messages.saidBy(p.panes[listed].?), "Callers: only a file's pane asks") != null); // Nothing found: Callers says so, and the waiting write hears it. p.fs.late_failure_len = 0; p.lspRequest(id, .incoming_calls, ""); @@ -2126,6 +2128,8 @@ test "with no pane at all, the root look opens its file and the root exec runs i if (pardes.Term.ops == null) return error.SkipZigTest; // a command pane const p = try withFile(testing.allocator, "x\n"); defer p.deinit(); + // About a jump opening a pane: `Jumps new-pane` (SPEC §6.6). + p.settings.jumps = .@"new-pane"; var tmp = testing.tmpDir(.{}); defer tmp.cleanup(); try tmp.dir.writeFile(testing.io, .{ .sub_path = "f.txt", .data = "file\n" }); @@ -2264,7 +2268,7 @@ test "a column takes panes until their documented minimums fill it, not until no const new = @backingInt(tree.TopFile.new); while (call(p, .{ .tag = 1, .op = .open, .node = new }).reply.status == .ok) p.sync(); p.sync(); - const avail = p.view().screen_h - (p.topBarHeight() + layout.columnBarHeight(p)); + const avail = p.view().screen_h - (p.topBarHeight() + layout.columnBarHeight(p) + layout.noticeRowHeight(p)); for (0..p.view().ncol) |c| { var need: u32 = 0; for (p.view().cols[c].panes[0..p.view().cols[c].n]) |k| need += layout.minRows(p, k); @@ -2388,7 +2392,9 @@ test "a file changed on disk under unsaved edits is not reloaded: it says so, ge pardes.panes.File.changed(p, 0, "three\n"); try testing.expectEqualStrings("two\nmine\n", f.content); try testing.expect(f.revision != f.saved_revision); - try testing.expect(th.logHas(p, "changed on disk (get reloads it, Save overwrites it)")); + // ...and asks, in its tag (Messages.waiting), which /log hears. + try testing.expect(p.messages.waiting(p.panes[0].?) != null); + try testing.expect(th.logHas(p, "changed on disk\n")); var want: [32]u8 = undefined; try testing.expect(th.logHas(p, try std.fmt.bufPrint(&want, "changed {d}\n", .{serial}))); // Exit and get still ask about the edits. diff --git a/core/ninep/events.zig b/core/ninep/events.zig index e18b5d96..fe9ec79a 100644 --- a/core/ninep/events.zig +++ b/core/ninep/events.zig @@ -1089,20 +1089,20 @@ test "writing an event record back performs the action it names" { const w = wr(p, event, "FX0 10\n"); try testing.expectEqual(Status.ok, w.reply.status); - try testing.expectEqualStrings("fs-ran", pane.msg[0..pane.msg_len]); + try testing.expectEqualStrings("fs-ran", p.messages.saidBy(pane)); - pane.msg_len = 0; + p.messages.live_len = 0; try testing.expectEqual(Status.ok, wr(p, event, "FX0 10\nFX0 10\n").reply.status); - try testing.expectEqualStrings("fs-ran", pane.msg[0..pane.msg_len]); + try testing.expectEqualStrings("fs-ran", p.messages.saidBy(pane)); // The last record needs no newline, as any line file's last line. - pane.msg_len = 0; + p.messages.live_len = 0; const bare = wr(p, event, "FX0 10"); try testing.expectEqual(Status.ok, bare.reply.status); try testing.expectEqual(@as(u32, 6), bare.reply.written); - try testing.expectEqualStrings("fs-ran", pane.msg[0..pane.msg_len]); + try testing.expectEqualStrings("fs-ran", p.messages.saidBy(pane)); - pane.msg_len = 0; + p.messages.live_len = 0; for ([_][]const u8{ "FX0 10\nFQ0 1\n", // unknown type character "FX0 999\n", // out of range @@ -1111,7 +1111,7 @@ test "writing an event record back performs the action it names" { "F\n", }) |bad| { try testing.expectEqual(E.INVAL, wr(p, event, bad).errno()); - try testing.expectEqual(@as(usize, 0), pane.msg_len); + try testing.expectEqual(@as(usize, 0), p.messages.saidBy(pane).len); } // A look written back sets what look reads back. _ = wr(p, event, "FL0 3\n"); diff --git a/core/ninep/tree.zig b/core/ninep/tree.zig index 01cfe297..4feb0153 100644 --- a/core/ninep/tree.zig +++ b/core/ninep/tree.zig @@ -2013,6 +2013,11 @@ test "random placements, refused or not, leave no pane under its tag and two row const rows = r.intRangeAtMost(u16, 6, 40); const p = try pardes.Pardes.init(testing.allocator, .{ .tty_only = true, .cols = r.intRangeAtMost(u16, 60, 240), .rows = rows }); defer p.deinit(); + // Placements as a Look made them before the walk: `Jumps new-pane` + // (SPEC §6.6). Under the walk a step in place can wrap its tag in a + // column with no rows to give (seed 109): the trail's give-way, + // not a placement's refusal (Trail.lift lifts it when there are). + p.settings.jumps = .@"new-pane"; while (p.nextEffect()) |_| {} _ = try p.setTestFile("x\n"); while (p.nextEffect()) |_| {} |
