Fix logic for aborting failed matches

This commit is contained in:
Max Brunsfeld 2020-05-08 14:15:25 -07:00
parent b0671aea6a
commit 9c0535cea6
2 changed files with 40 additions and 8 deletions

View file

@ -595,6 +595,33 @@ fn test_query_matches_with_top_level_repetitions() {
});
}
#[test]
fn test_query_matches_with_non_terminal_repetitions_within_root() {
allocations::record(|| {
let language = get_language("javascript");
let query = Query::new(
language,
r#"
(*
(expression_statement
(identifier) @id)+)
"#,
)
.unwrap();
assert_query_matches(
language,
&query,
r#"
a;
b;
c;
"#,
&[(0, vec![("id", "a"), ("id", "b"), ("id", "c")])],
);
});
}
#[test]
fn test_query_matches_with_nested_repetitions() {
allocations::record(|| {