Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
xdBronch committed Jan 5, 2024
1 parent 71146b1 commit e87f7d3
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions tests/utility/offsets.zig
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ const zls = @import("zls");

const types = zls.types;
const offsets = zls.offsets;
const Loc = offsets.Loc;

const Ast = std.zig.Ast;

Expand Down Expand Up @@ -130,7 +131,7 @@ test "offsets - convertPositionEncoding" {
try testConvertPositionEncoding("a¶↉🠁\na¶↉🠁", 1, 6, .{ 6, 3, 3 });
}
test "offsets - locIntersect" {
const a = offsets.Loc{ .start = 2, .end = 5 };
const a = Loc{ .start = 2, .end = 5 };
try std.testing.expect(offsets.locIntersect(a, .{ .start = 0, .end = 2 }) == false);
try std.testing.expect(offsets.locIntersect(a, .{ .start = 1, .end = 3 }) == true);
try std.testing.expect(offsets.locIntersect(a, .{ .start = 2, .end = 4 }) == true);
Expand All @@ -140,7 +141,7 @@ test "offsets - locIntersect" {
}

test "offsets - locInside" {
const outer = offsets.Loc{ .start = 2, .end = 5 };
const outer = Loc{ .start = 2, .end = 5 };
try std.testing.expect(offsets.locInside(.{ .start = 0, .end = 2 }, outer) == false);
try std.testing.expect(offsets.locInside(.{ .start = 1, .end = 3 }, outer) == false);
try std.testing.expect(offsets.locInside(.{ .start = 2, .end = 4 }, outer) == true);
Expand All @@ -150,13 +151,13 @@ test "offsets - locInside" {
}

test "offsets - locMerge" {
const a = offsets.Loc{ .start = 2, .end = 5 };
try std.testing.expectEqualDeep(offsets.locMerge(a, .{ .start = 0, .end = 2 }), .{ .start = 0, .end = 5 });
try std.testing.expectEqualDeep(offsets.locMerge(a, .{ .start = 1, .end = 3 }), .{ .start = 1, .end = 5 });
try std.testing.expectEqualDeep(offsets.locMerge(a, .{ .start = 2, .end = 4 }), .{ .start = 2, .end = 5 });
try std.testing.expectEqualDeep(offsets.locMerge(a, .{ .start = 3, .end = 5 }), .{ .start = 2, .end = 5 });
try std.testing.expectEqualDeep(offsets.locMerge(a, .{ .start = 4, .end = 6 }), .{ .start = 2, .end = 6 });
try std.testing.expectEqualDeep(offsets.locMerge(a, .{ .start = 5, .end = 7 }), .{ .start = 2, .end = 7 });
const a = Loc{ .start = 2, .end = 5 };
try std.testing.expectEqualDeep(offsets.locMerge(a, .{ .start = 0, .end = 2 }), Loc{ .start = 0, .end = 5 });
try std.testing.expectEqualDeep(offsets.locMerge(a, .{ .start = 1, .end = 3 }), Loc{ .start = 1, .end = 5 });
try std.testing.expectEqualDeep(offsets.locMerge(a, .{ .start = 2, .end = 4 }), Loc{ .start = 2, .end = 5 });
try std.testing.expectEqualDeep(offsets.locMerge(a, .{ .start = 3, .end = 5 }), Loc{ .start = 2, .end = 5 });
try std.testing.expectEqualDeep(offsets.locMerge(a, .{ .start = 4, .end = 6 }), Loc{ .start = 2, .end = 6 });
try std.testing.expectEqualDeep(offsets.locMerge(a, .{ .start = 5, .end = 7 }), Loc{ .start = 2, .end = 7 });
}

test "offsets - advancePosition" {
Expand Down

0 comments on commit e87f7d3

Please sign in to comment.