summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorydah <t.yudai92@gmail.com>2024-09-24 20:05:12 +0900
committerYuichiro Kaneko <spiketeika@gmail.com>2024-09-30 18:04:41 +0900
commit044e57ed7c34bfe2cea6e7dcc685cc0a4050c86f (patch)
tree8860acb22cee3b0882e94ed6ca7da976daef40b7 /test
parent239c1c621e92f519498e421cf825f44667c0e56c (diff)
Implement SPLAT NODE keyword locations
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/11673
Diffstat (limited to 'test')
-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 8de4a5bfe2..91f4250cfc 100644
--- a/test/ruby/test_ast.rb
+++ b/test/ruby/test_ast.rb
@@ -1424,6 +1424,20 @@ dummy
assert_locations(node.children[-1].locations, [[1, 0, 1, 6], [1, 0, 1, 6]])
end
+ def test_splat_locations
+ node = ast_parse("a = *1")
+ assert_locations(node.children[-1].children[1].locations, [[1, 4, 1, 6], [1, 4, 1, 5]])
+
+ node = ast_parse("a = *1, 2")
+ assert_locations(node.children[-1].children[1].children[0].locations, [[1, 4, 1, 6], [1, 4, 1, 5]])
+
+ node = ast_parse("case a; when *1; end")
+ assert_locations(node.children[-1].children[1].children[0].locations, [[1, 13, 1, 15], [1, 13, 1, 14]])
+
+ node = ast_parse("case a; when *1, 2; end")
+ assert_locations(node.children[-1].children[1].children[0].children[0].locations, [[1, 13, 1, 15], [1, 13, 1, 14]])
+ end
+
def test_unless_locations
node = ast_parse("unless cond then 1 else 2 end")
assert_locations(node.children[-1].locations, [[1, 0, 1, 29], [1, 0, 1, 6], [1, 12, 1, 16], [1, 26, 1, 29]])