Fix match return order fom ts_query_cursor_next_match

This commit is contained in:
Max Brunsfeld 2019-09-17 14:52:27 -07:00
parent 1af85dc3f7
commit 2d1ca8bc9f
3 changed files with 21 additions and 16 deletions

View file

@ -266,15 +266,15 @@ fn test_query_matches_with_nesting_and_no_fields() {
"
(array
(array
(identifier) @element-1
(identifier) @element-2))
(identifier) @x1
(identifier) @x2))
",
)
.unwrap();
let source = "
[[a]];
[[c, d], [e, f, g]];
[[c, d], [e, f, g, h]];
[[h], [i]];
";
@ -287,10 +287,13 @@ fn test_query_matches_with_nesting_and_no_fields() {
assert_eq!(
collect_matches(matches, &query, source),
&[
(0, vec![("element-1", "c"), ("element-2", "d")]),
(0, vec![("element-1", "e"), ("element-2", "f")]),
(0, vec![("element-1", "f"), ("element-2", "g")]),
(0, vec![("element-1", "e"), ("element-2", "g")]),
(0, vec![("x1", "c"), ("x2", "d")]),
(0, vec![("x1", "e"), ("x2", "f")]),
(0, vec![("x1", "e"), ("x2", "g")]),
(0, vec![("x1", "f"), ("x2", "g")]),
(0, vec![("x1", "e"), ("x2", "h")]),
(0, vec![("x1", "f"), ("x2", "h")]),
(0, vec![("x1", "g"), ("x2", "h")]),
],
);
});