summaryrefslogtreecommitdiff
path: root/test/output.zig
diff options
context:
space:
mode:
Diffstat (limited to 'test/output.zig')
-rw-r--r--test/output.zig70
1 files changed, 9 insertions, 61 deletions
diff --git a/test/output.zig b/test/output.zig
index 3cfece45..876cd8fc 100644
--- a/test/output.zig
+++ b/test/output.zig
@@ -389,7 +389,9 @@ test "result stepping reaches an unterminated last row" {
try std.testing.expectEqual(@as(i32, 1), result.body.cur_row);
}
-test "Mini uses OS source precedence and refreshes one independent snapshot" {
+// What it shows and when it refreshes is test/behaviour/builtins.zig's;
+// the watch it never asks for is an effect, unseen through 9P.
+test "Mini asks for no watch on its pane" {
var tmp = std.testing.tmpDir(.{});
defer tmp.cleanup();
try tmp.dir.writeFile(std.testing.io, .{ .sub_path = "build.zig", .data = "x\n" });
@@ -401,27 +403,11 @@ test "Mini uses OS source precedence and refreshes one independent snapshot" {
try std.testing.expect(p.executeBuiltinLine(0, "Mini build.zig"));
const id = p.active;
try std.testing.expect(id != 0);
- const mini = p.panes[id].?;
- try std.testing.expect(mini.terminal == null);
- try std.testing.expectEqualStrings("⠁\n", mini.file.?.content);
- try std.testing.expect(std.mem.startsWith(u8, mini.file.?.mini.?.source, dir));
- const next = p.freeSlot();
- const body = mini.file.?.content.ptr;
- try std.testing.expect(p.executeBuiltinLine(id, "Mini build.zig"));
- try std.testing.expectEqual(id, p.active);
- try std.testing.expectEqual(body, mini.file.?.content.ptr);
- try std.testing.expectEqual(next, p.freeSlot());
- try tmp.dir.writeFile(std.testing.io, .{ .sub_path = "build.zig", .data = "xx\n" });
- try std.testing.expectEqualStrings("⠁\n", mini.file.?.content);
try std.testing.expect(p.executeBuiltinLine(id, "Mini build.zig"));
- try std.testing.expectEqual(id, p.active);
- try std.testing.expectEqualStrings("⠉\n", mini.file.?.content);
while (p.nextEffect()) |effect| switch (effect) {
.watch => |watch| try std.testing.expect(watch.pane != id),
else => {},
};
- try std.testing.expect(p.executeBuiltinLine(id, "Save"));
- try std.testing.expect(mini.prompt == .save);
}
test "Mini dump preserves its exact virtual snapshot and body writes detach colors" {
@@ -617,7 +603,7 @@ test "EffectCode lists readable virtual sources used by this backend" {
try std.testing.expectEqualStrings(pardes.filesystem.sourceBytes(backend_source["/virtual/".len..]).?, source.content);
}
-test "every enabled setting builtin mutates the State Config reports" {
+test "a window's setting builtins (TaglineSize, Font, transitions, scene passes) reach the report DumpConfig writes" {
const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true });
defer p.deinit();
p.locations_config.layout = .@"inline";
@@ -653,14 +639,8 @@ test "every enabled setting builtin mutates the State Config reports" {
try std.testing.expect(p.executeBuiltinLine(p.active, "DumpConfig"));
const report = p.panes[p.active].?.file.?.content;
- for ([_][]const u8{
- "Colors off\n",
- "Wrap off\n",
- "Tagbottom on\n",
- "Debug on\n",
- "Theme acme\n",
- "Shell fish\n",
- }) |line| try std.testing.expect(std.mem.indexOf(u8, report, line) != null);
+ // The toggles, Theme and Shell are test/behaviour/settings.zig's, through
+ // the root ctl; what is left is a window's (fonts, transitions, passes).
const transition = if (!builtins.viewCapabilities(p).panel_transitions)
"PanelSlide unsupported\n"
else if (p.settings.panel_transition == .off)
@@ -821,7 +801,7 @@ test "LookNext/LookPrev selects one output location per row and opens nothing" {
try std.testing.expectEqual(panes.Output.Grain.word, panes.Output.grain(p.panes[p.active].?.file.?.output));
}
-test "LookNext/LookPrev resumes the result output whose Look moved focus away" {
+test "LookNext/LookPrev keeps the result output a Look chose through a no-match answer, and a stale serial once it is deleted" {
if (platform == .web) return;
var tmp = std.testing.tmpDir(.{});
defer tmp.cleanup();
@@ -844,12 +824,8 @@ test "LookNext/LookPrev resumes the result output whose Look moved focus away" {
try std.testing.expect(results.look_at != null);
try std.testing.expectEqual(results.serial, p.look_walk_owner orelse return error.MissingLookOwner);
- lookKey(p, 'n');
- try std.testing.expectEqual(rid, p.active);
- try std.testing.expectEqual(first + 1, results.body.cur_row);
- lookKey(p, 'N');
- try std.testing.expectEqual(first, results.body.cur_row);
-
+ // The walk on and back from it is test/behaviour/keys.zig's; what is
+ // left needs answers put in by fillResults.
// A later no-match answer has no position to resume and therefore cannot
// steal the provenance established by the Look above.
const owner = results.serial;
@@ -924,34 +900,6 @@ test "LookPrev exactly reverses LookNext across output panes and the ring seam"
try std.testing.expect(saw_first and saw_second);
}
-test "LookNext/LookPrev selects command outputs by whole row" {
- if (platform == .web) return;
- var cwd_buf: [4096]u8 = undefined;
- var path_buf: [4096]u8 = undefined;
- const paths = try projectPaths(&cwd_buf, &path_buf);
- const p = try Pardes.init(std.testing.allocator, .{ .cols = 100, .rows = 40, .file = paths.boot });
- defer p.deinit();
- p.update(.{ .resize = .{ .cols = 100, .rows = 40 } });
-
- try std.testing.expect(p.executeBuiltinLine(p.active, "Themes"));
- const tid = p.panes[p.active].?.search_pane orelse return error.MissingThemeList;
- const themes = p.panes[tid].?;
- try std.testing.expect(panes.Output.fileTraits(themes.file.?.output).commands);
- lookKey(p, 'n');
- const row0 = std.mem.trimEnd(u8, modal.lineSlice(themes.file.?.content, 1), " \t\r");
- try std.testing.expectEqualStrings(row0, selectedOutputText(themes) orelse "");
- const theme_before = p.settings.theme;
- lookKey(p, 'n');
- p.update(.{ .key = .{ .cp = Key.tab } });
- try std.testing.expect(p.settings.theme != theme_before);
-
- try std.testing.expect(p.executeBuiltinLine(0, "Look build.zig"));
- p.update(.tick);
- try std.testing.expect(p.active != 0);
- lookKey(p, 'n');
- try std.testing.expectEqual(@as(usize, 0), p.active);
-}
-
test "identical result refresh keeps warm content caches without allocation" {
var allocator: std.testing.FailingAllocator = .init(std.testing.allocator, .{});
const p = try Pardes.init(allocator.allocator(), .{ .tty_only = true, .cols = 80, .rows = 24 });