From eff16d93025d354de08cb40a11a51acffdf26e57 Mon Sep 17 00:00:00 2001 From: ydah Date: Fri, 27 Sep 2024 02:01:08 +0900 Subject: Implement OP_ASGN1 NODE locations --- test/ruby/test_ast.rb | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'test/ruby') diff --git a/test/ruby/test_ast.rb b/test/ruby/test_ast.rb index 940c4de9d7..f1328b15ed 100644 --- a/test/ruby/test_ast.rb +++ b/test/ruby/test_ast.rb @@ -1381,6 +1381,14 @@ dummy assert_locations(node.children[-1].children[-1].children[-1].locations, [[1, 7, 1, 13], [1, 7, 1, 11]]) end + def test_op_asgn1_locations + node = ast_parse("ary[1] += foo") + assert_locations(node.children[-1].locations, [[1, 0, 1, 13], nil, [1, 3, 1, 4], [1, 5, 1, 6], [1, 7, 1, 9]]) + + node = ast_parse("ary[1, 2] += foo") + assert_locations(node.children[-1].locations, [[1, 0, 1, 16], nil, [1, 3, 1, 4], [1, 8, 1, 9], [1, 10, 1, 12]]) + end + def test_or_locations node = ast_parse("1 or 2") assert_locations(node.children[-1].locations, [[1, 0, 1, 6], [1, 2, 1, 4]]) -- cgit v1.2.3