From c16312323e41863ec8fc99847132d6303ea8fa96 Mon Sep 17 00:00:00 2001 From: "Zoltan K." Date: Tue, 24 Dec 2024 04:09:36 +0100 Subject: [PATCH] fix(node): fix range end point (#3) --- src/node.zig | 2 +- src/test.zig | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/node.zig b/src/node.zig index 72dd89f..3ae2dd5 100644 --- a/src/node.zig +++ b/src/node.zig @@ -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() }; } diff --git a/src/test.zig b/src/test.zig index 6955b2a..786f92c 100644 --- a/src/test.zig +++ b/src/test.zig @@ -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());