Skip to content

Commit

Permalink
fix(node): fix range end point (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
zoltan-kski authored Dec 24, 2024
1 parent 9bae076 commit c163123
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/node.zig
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ pub const Node = extern struct {
.start_byte = self.startByte(),
.end_byte = self.endByte(),
.start_point = self.startPoint(),
.end_point = self.startPoint()
.end_point = self.endPoint()
};
}

Expand Down
6 changes: 6 additions & 0 deletions src/test.zig
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,12 @@ test "Node" {
try testing.expectEqual(0, node.startPoint().column);
try testing.expectEqual(13, node.endPoint().column);

const range = node.range();
try testing.expectEqual(0, range.start_byte);
try testing.expectEqual(13, range.end_byte);
try testing.expectEqual(0, range.start_point.column);
try testing.expectEqual(13, range.end_point.column);

try testing.expectEqual(1, node.childCount());
try testing.expectEqual(1, node.namedChildCount());
try testing.expectEqual(11, node.descendantCount());
Expand Down

0 comments on commit c163123

Please sign in to comment.