summaryrefslogtreecommitdiff
path: root/test/ruby
diff options
context:
space:
mode:
authorydah <[email protected]>2024-09-11 16:17:15 +0900
committerYuichiro Kaneko <[email protected]>2024-09-25 09:06:42 +0900
commit31a88d1554550a7c70fd63991051890c4fd71ac7 (patch)
treec89114916dfefb020753a1c17f8386c2ece16a82 /test/ruby
parent6b46060fc29055b1e1d38da83959f4f2c98edfb1 (diff)
Implement RETURN NODE keyword locations
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/11589
Diffstat (limited to 'test/ruby')
-rw-r--r--test/ruby/test_ast.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/test/ruby/test_ast.rb b/test/ruby/test_ast.rb
index 06fb3c56c0..38c0d56a0f 100644
--- a/test/ruby/test_ast.rb
+++ b/test/ruby/test_ast.rb
@@ -1386,6 +1386,14 @@ dummy
assert_locations(node.children[-1].children[-1].children[-1].locations, [[1, 7, 1, 11], [1, 7, 1, 11]])
end
+ def test_return_locations
+ node = ast_parse("return 1")
+ assert_locations(node.children[-1].locations, [[1, 0, 1, 8], [1, 0, 1, 6]])
+
+ node = ast_parse("return")
+ assert_locations(node.children[-1].locations, [[1, 0, 1, 6], [1, 0, 1, 6]])
+ 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]])