chore: update test

This commit is contained in:
Amaan Qureshi 2023-07-18 19:29:40 -04:00
parent c436897662
commit 76f5f81aee
No known key found for this signature in database
GPG key ID: E67890ADC4227273
2 changed files with 11 additions and 2 deletions

View file

@ -429,7 +429,12 @@ fn set_included_ranges(parser: &mut Parser, input: &[u8], delimiters: Option<(&s
let mut ranges = Vec::new();
let mut ix = 0;
while ix < input.len() {
let Some(mut start_ix) = input[ix..].windows(2).position(|win| win == start.as_bytes()) else { break };
let Some(mut start_ix) = input[ix..]
.windows(2)
.position(|win| win == start.as_bytes())
else {
break;
};
start_ix += ix + start.len();
let end_ix = input[start_ix..]
.windows(2)

View file

@ -252,9 +252,13 @@ fn test_node_parent_of_child_by_field_name() {
fn test_node_field_name_for_child() {
let mut parser = Parser::new();
parser.set_language(get_language("c")).unwrap();
let tree = parser.parse("x + y;", None).unwrap();
let tree = parser.parse("void main() { x + y; }", None).unwrap();
let translation_unit_node = tree.root_node();
let binary_expression_node = translation_unit_node
.named_child(0)
.unwrap()
.named_child(2)
.unwrap()
.named_child(0)
.unwrap()
.named_child(0)