Merge remote-tracking branch 'origin/master' into ensure-extras-is-array

This commit is contained in:
Patrick Thomson 2020-10-05 16:12:37 -04:00
commit adce3cb8e2
7 changed files with 64 additions and 9 deletions

View file

@ -37,11 +37,11 @@ tiny_http = "0.6"
webbrowser = "0.5.1"
[dependencies.tree-sitter]
version = ">= 0.3.7"
version = ">= 0.17.0"
path = "../lib"
[dependencies.tree-sitter-highlight]
version = ">= 0.1.0"
version = ">= 0.3.0"
path = "../highlight"
[dependencies.tree-sitter-tags]

View file

@ -1691,6 +1691,36 @@ fn test_query_matches_with_multiple_captures_on_a_node() {
});
}
#[test]
fn test_query_matches_with_no_captures() {
allocations::record(|| {
let language = get_language("javascript");
let query = Query::new(
language,
r#"
(identifier)
(string) @s
"#,
)
.unwrap();
assert_query_matches(
language,
&query,
"
a = 'hi';
b = 'bye';
",
&[
(0, vec![]),
(1, vec![("s", "'hi'")]),
(0, vec![]),
(1, vec![("s", "'bye'")]),
],
);
});
}
#[test]
fn test_query_captures_basic() {
allocations::record(|| {