File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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) ----
You can’t perform that action at this time.
0 commit comments