summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-04 23:43:45 -0300
committerGabriel Schneider <[email protected]>2026-11-04 23:48:44 -0300
commit55492ffa53d7df11a38c6639f8fde6cdc87800c7 (patch)
treed6515b6a0dbcac62c305c999ad5865943b4c466a /test
parent5a927d1a4e92750bc0d48994df2c2e552d669b01 (diff)
downloadpardes-55492ffa53d7df11a38c6639f8fde6cdc87800c7.tar.gz
pardes-55492ffa53d7df11a38c6639f8fde6cdc87800c7.zip
Find, Grep: their output traits, Output's sort of a Find's whole filenames above its walk notes, and fs.WalkNotes go, as both search on the disk engine (Stream.zig, which keeps the walk's depth as max_walk_depth) and nothing makes a .cmd = .Find or .Grep pane; the tests that filled one fill a .search or query pane (ctl.zig's is now "workspace symbols, Symbols and Diagnostics share their directory's one +Search"), and the Find sort test keeps its half on next location ("next location uses numeric columns")
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge
Diffstat (limited to 'test')
-rw-r--r--test/locations_bench.zig2
-rw-r--r--test/output.zig14
2 files changed, 4 insertions, 12 deletions
diff --git a/test/locations_bench.zig b/test/locations_bench.zig
index 54cebb59..ecf2649d 100644
--- a/test/locations_bench.zig
+++ b/test/locations_bench.zig
@@ -50,7 +50,7 @@ test "locations benchmark cold and warm formatting" {
_ = p.scratch.reset(.retain_capacity);
const data = try gpa.dupe(u8, input.written());
const t = now();
- try pds.panes.Output.fillResults(p, 0, "/bench", .{ .cmd = .Grep }, "BENCH_MATCH", data, null);
+ try pds.panes.Output.fillResults(p, 0, "/bench", .{ .query = .references }, "BENCH_MATCH", data, null);
const elapsed = now() - t;
const modes = [_][]const u8{ "off", "ordinary", "tree_sitter", "both" };
std.debug.print("{s},{s},{d},{d},{s},{d},{d}\n", .{ @tagName(layout), modes[mode], functions, source.written().len, if (rep == 0) "cold" else "warm", rep, elapsed });
diff --git a/test/output.zig b/test/output.zig
index f484c3e6..c476af28 100644
--- a/test/output.zig
+++ b/test/output.zig
@@ -120,7 +120,7 @@ test "output callers opt into location highlighting instead of matching prose co
}
test "location producers retain rendered location match and diagnostic styles" {
- for ([_]panes.Output.Origin{ .search, .{ .cmd = .Grep }, .{ .query = .references }, .{ .query = .diagnostics } }) |origin| {
+ for ([_]panes.Output.Origin{ .search, .{ .query = .references }, .{ .query = .diagnostics } }) |origin| {
const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 140, .rows = 30 });
defer p.deinit();
p.locations_config.layout = .@"inline";
@@ -156,7 +156,7 @@ test "location producers retain rendered location match and diagnostic styles" {
test "location results sort filenames and numeric positions while remapping their anchor" {
const before = "z.zig:1:1 z\nb.zig:10:2-3 ten\nb.zig:2:10-12 two-b\nb.zig:2:2-3 two-a\na.zig:99:1 a\nb.zig:2:2-3 duplicate\n";
const after = "a.zig:99:1 a\nb.zig:2:2-3 two-a\nb.zig:2:2-3 duplicate\nb.zig:2:10-12 two-b\nb.zig:10:2-3 ten\nz.zig:1:1 z\n";
- for ([_]panes.Output.Origin{ .search, .{ .cmd = .Grep }, .{ .query = .references }, .{ .query = .diagnostics } }) |origin| {
+ for ([_]panes.Output.Origin{ .search, .{ .query = .references }, .{ .query = .diagnostics } }) |origin| {
const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true });
defer p.deinit();
p.locations_config.layout = .@"inline";
@@ -361,15 +361,7 @@ test "result sorting allocation failures preserve the previous answer and naviga
}
}
-test "Find sorts whole filenames and next location uses numeric columns" {
- const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true });
- defer p.deinit();
- p.locations_config.layout = .@"inline";
- const source = try p.setTestFile("");
- try panes.Output.fillResults(p, 0, "/tmp", .{ .cmd = .Find }, "", try p.gpa.dupe(u8, "x:2\nx:10\n"), 0);
- const result = p.panes[source.search_pane.?].?;
- try std.testing.expectEqualStrings("x:10\nx:2\n", result.file.?.content);
- try std.testing.expectEqual(@as(usize, 1), source.search_row.?);
+test "next location uses numeric columns" {
const rows = "with space.zig:2:2-3 first\nwith space.zig:2:10-12 next\nwith space.zig:10:1 later";
try std.testing.expectEqual(@as(usize, 1), panes.Output.nextResult(rows, &.{}, "with space.zig", .{ .line = 2, .col = 3 }));
try std.testing.expectEqual(@as(usize, 2), panes.Output.nextResult(rows, &.{}, "with space.zig", .{ .line = 2, .col = 10 }));