summaryrefslogtreecommitdiff
path: root/test/ruby
diff options
context:
space:
mode:
authorydah <t.yudai92@gmail.com>2024-09-03 17:53:55 +0900
committerYuichiro Kaneko <spiketeika@gmail.com>2024-09-03 21:15:12 +0900
commitaf143d8a749ae0ba0f394521dd46bea824a354fa (patch)
treed27074dc71ff379dde01cf6ed9992d1168bc0dff /test/ruby
parentb7fa2dd0d0b7328f8f713b7cf0332d1e34c20fe4 (diff)
Implement UNDEF NODE keyword locations
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/11523
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 936dd6d3e6..d21c57d88f 100644
--- a/test/ruby/test_ast.rb
+++ b/test/ruby/test_ast.rb
@@ -1338,6 +1338,14 @@ dummy
assert_locations(node.children[-1].locations, [[1, 0, 1, 10], [1, 2, 1, 8], nil, nil])
end
+ def test_undef_locations
+ node = RubyVM::AbstractSyntaxTree.parse("undef foo")
+ assert_locations(node.children[-1].locations, [[1, 0, 1, 9], [1, 0, 1, 5]])
+
+ node = RubyVM::AbstractSyntaxTree.parse("undef foo, bar")
+ assert_locations(node.children[-1].locations, [[1, 0, 1, 14], [1, 0, 1, 5]])
+ end
+
private
def assert_locations(locations, expected)
ary = locations.map {|loc| loc && [loc.first_lineno, loc.first_column, loc.last_lineno, loc.last_column] }