Fix handling of queries with field names at the roots of patterns
Fixes #1018
This commit is contained in:
parent
6e8b5e7643
commit
72143b17ff
2 changed files with 21 additions and 2 deletions
|
|
@ -991,6 +991,24 @@ fn test_query_matches_with_negated_fields() {
|
|||
});
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_query_matches_with_field_at_root() {
|
||||
allocations::record(|| {
|
||||
let language = get_language("javascript");
|
||||
let query = Query::new(language, "name: (identifier) @name").unwrap();
|
||||
assert_query_matches(
|
||||
language,
|
||||
&query,
|
||||
"
|
||||
a();
|
||||
function b() {}
|
||||
class c extends d {}
|
||||
",
|
||||
&[(0, vec![("name", "b")]), (0, vec![("name", "c")])],
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_query_matches_with_repeated_leaf_nodes() {
|
||||
allocations::record(|| {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue