query: Fix invalid use of slice::from_raw_parts

This commit is contained in:
Max Brunsfeld 2020-10-05 12:07:16 -07:00
parent 2a3c2ad6b9
commit d1c95193c1
3 changed files with 54 additions and 2 deletions

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(|| {