diff options
Diffstat (limited to 'test/output.zig')
| -rw-r--r-- | test/output.zig | 55 |
1 files changed, 0 insertions, 55 deletions
diff --git a/test/output.zig b/test/output.zig index c476af28..9fba1a77 100644 --- a/test/output.zig +++ b/test/output.zig @@ -793,61 +793,6 @@ 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 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(); - try tmp.dir.writeFile(std.testing.io, .{ - .sub_path = "look-owner.txt", - .data = "alpha target\nbeta target\ngamma target\n", - }); - var path_buf: [256]u8 = undefined; - const path = try std.fmt.bufPrint(&path_buf, ".zig-cache/tmp/{s}/look-owner.txt", .{tmp.sub_path}); - const p = try Pardes.init(std.testing.allocator, .{ .file = path, .cols = 80, .rows = 24 }); - defer p.deinit(); - p.locations_config.layout = .@"inline"; - p.settings.look_word = .list; // the +Search listing is what is walked - - try std.testing.expect(p.executeBuiltinLine(0, "Look target")); - const rid = p.panes[0].?.search_pane orelse return error.MissingResults; - const results = p.panes[rid].?; - const first = results.body.cur_row; - try std.testing.expectEqual(@as(usize, 0), p.active); - try std.testing.expect(results.look_at != null); - try std.testing.expectEqual(results.serial, p.look_walk_owner orelse return error.MissingLookOwner); - - // 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; - const dir = std.fs.path.dirname(path) orelse "."; - try panes.Output.fillResults( - p, - 0, - dir, - .search, - "no-such-result", - try p.gpa.dupe(u8, ""), - null, - ); - try std.testing.expectEqual(owner, p.look_walk_owner.?); - lookKey(p, 'n'); - try std.testing.expectEqual(rid, p.active); - try std.testing.expectEqual(first + 1, results.body.cur_row); - - // Emptying the owner itself keeps its identity as the ring's starting - // point. Deleting it then leaves a stale serial, never an id that can bind - // to the unrelated pane subsequently allocated in the same slot. - try panes.Output.fillResults(p, 0, dir, .search, "target", try p.gpa.dupe(u8, ""), null); - try std.testing.expectEqual(owner, p.look_walk_owner.?); - try std.testing.expect(p.executeBuiltinLine(rid, "Del")); - try std.testing.expect(p.paneBySerial(owner) == null); - const replacement = try p.newShell(rid, ""); - try std.testing.expect(replacement.serial != owner); - try std.testing.expect(p.paneBySerial(owner) == null); -} - test "LookPrev exactly reverses LookNext across output panes and the ring seam" { if (platform == .web) return; var cwd_buf: [4096]u8 = undefined; |
