Skip to content

Commit 496cd17

Browse files
Copilotaschackmull
andauthored
Fix yeast elided token regression test
Co-authored-by: aschackmull <28296824+aschackmull@users.noreply.github.com>
1 parent 39ffd10 commit 496cd17

1 file changed

Lines changed: 12 additions & 4 deletions

File tree

shared/yeast/tests/test.rs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1679,13 +1679,21 @@ fn test_elided_tokens_contribute_to_replacement_location() {
16791679
);
16801680

16811681
let ast = run_and_ast("foo.bar()", vec![rule]);
1682-
let root = ast.get_node(ast.get_root()).unwrap();
1683-
let stmt_field = ast.field_id_for_name("stmt").unwrap();
1684-
let call_id = root.field_children(stmt_field)[0];
1682+
let call_ids: Vec<yeast::Id> = ast
1683+
.reachable_node_ids()
1684+
.into_iter()
1685+
.filter(|&id| {
1686+
ast.get_node(id)
1687+
.is_some_and(|node| node.kind_name() == "call")
1688+
})
1689+
.collect();
1690+
1691+
assert_eq!(call_ids.len(), 1, "expected exactly one reachable call");
1692+
let call_id = call_ids[0];
16851693
let call = ast.get_node(call_id).unwrap();
16861694

16871695
assert_eq!(call.start_byte(), 0);
1688-
assert_eq!(call.end_byte(), 7);
1696+
assert_eq!(call.end_byte(), 9);
16891697
}
16901698

16911699
// ---- `rules!` macro tests (compile-time type-checking) ----

0 commit comments

Comments
 (0)