diff options
Diffstat (limited to 'test')
| -rw-r--r-- | test/output.zig | 5 | ||||
| -rw-r--r-- | test/panes.zig | 13 |
2 files changed, 14 insertions, 4 deletions
diff --git a/test/output.zig b/test/output.zig index 128d6ff5..722f2e44 100644 --- a/test/output.zig +++ b/test/output.zig @@ -1323,7 +1323,10 @@ test "declaration context ellipses mark only final header lines before omitted s try std.testing.expect(row.location_end > 0); if (row.at.line == 16) try std.testing.expectEqual(index, source.search_row.?); } else if (row.declaration) { - try std.testing.expectEqual(visible, row.location_end > 0); + const first_line = row.at.line == 1 or row.at.line == 3 or row.at.line == 7 or row.at.line == 8; + try std.testing.expectEqual(visible and first_line, row.location_end > 0); + try std.testing.expectEqualStrings(source.file.?.path, row.path); + if (!first_line) try std.testing.expect(std.mem.indexOf(u8, shown[0..row.code_start], row.path) == null); } else try std.testing.expectEqual(@as(usize, 0), row.location_end); } try std.testing.expectEqual(@as(usize, if (neighbors == 0) 3 else 2), marked); diff --git a/test/panes.zig b/test/panes.zig index da06f692..d844f26e 100644 --- a/test/panes.zig +++ b/test/panes.zig @@ -2322,6 +2322,7 @@ const OutputTests = struct { if (row.kind == .match) { matches += 1; try std.testing.expect(!row.declaration); + try std.testing.expect(row.location_end > 0); const location = panes.Output.location(line); try std.testing.expectEqualStrings(path, location.path); try std.testing.expectEqual(row.at, location.at); @@ -2332,9 +2333,15 @@ const OutputTests = struct { } } else if (row.at.line <= 5) { try std.testing.expect(row.declaration); - try std.testing.expect(row.location_end > 0); - try std.testing.expect(std.mem.startsWith(u8, line, path)); - try std.testing.expectEqualStrings(path, panes.Output.location(line).path); + try std.testing.expectEqualStrings(path, row.path); + if (row.at.line <= 3) { + try std.testing.expect(row.location_end > 0); + try std.testing.expect(std.mem.startsWith(u8, line, path)); + try std.testing.expectEqualStrings(path, panes.Output.location(line).path); + } else { + try std.testing.expectEqual(@as(usize, 0), row.location_end); + try std.testing.expect(std.mem.indexOf(u8, line[0..row.code_start], path) == null); + } } else { try std.testing.expect(!row.declaration); try std.testing.expectEqual(@as(usize, 0), row.location_end); |
