summaryrefslogtreecommitdiff
path: root/test/ruby
diff options
context:
space:
mode:
authorydah <[email protected]>2024-09-27 02:32:27 +0900
committerYuichiro Kaneko <[email protected]>2024-09-28 20:53:09 +0900
commit8f678d69895d8b0562a52925a1840b698e021f56 (patch)
tree2bd7e499963b8403646b9940b1f0ff509c7bb96c /test/ruby
parent027ef60500c43fecbd4784cf24a99f6955606567 (diff)
Implement OP_ASGN2 NODE locations
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/11702
Diffstat (limited to 'test/ruby')
-rw-r--r--test/ruby/test_ast.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/ruby/test_ast.rb b/test/ruby/test_ast.rb
index f1328b15ed..8de4a5bfe2 100644
--- a/test/ruby/test_ast.rb
+++ b/test/ruby/test_ast.rb
@@ -1397,6 +1397,20 @@ dummy
assert_locations(node.children[-1].locations, [[1, 0, 1, 6], [1, 2, 1, 4]])
end
+ def test_op_asgn2_locations
+ node = ast_parse("a.b += 1")
+ assert_locations(node.children[-1].locations, [[1, 0, 1, 8], [1, 1, 1, 2], [1, 2, 1, 3], [1, 4, 1, 6]])
+
+ node = ast_parse("A::B.c += d")
+ assert_locations(node.children[-1].locations, [[1, 0, 1, 11], [1, 4, 1, 5], [1, 5, 1, 6], [1, 7, 1, 9]])
+
+ node = ast_parse("a = b.c += d")
+ assert_locations(node.children[-1].children[-1].locations, [[1, 4, 1, 12], [1, 5, 1, 6], [1, 6, 1, 7], [1, 8, 1, 10]])
+
+ node = ast_parse("a = A::B.c += d")
+ assert_locations(node.children[-1].children[-1].locations, [[1, 4, 1, 15], [1, 8, 1, 9], [1, 9, 1, 10], [1, 11, 1, 13]])
+ end
+
def test_redo_locations
node = ast_parse("loop { redo }")
assert_locations(node.children[-1].children[-1].children[-1].locations, [[1, 7, 1, 11], [1, 7, 1, 11]])