summaryrefslogtreecommitdiff
path: root/test/ruby/test_ast.rb
diff options
context:
space:
mode:
authorNARUSE, Yui <naruse@airemix.jp>2020-03-13 21:43:44 +0900
committerNARUSE, Yui <naruse@airemix.jp>2020-03-13 21:51:06 +0900
commit5bdbee96e479f714c7f9b6b98f012268cbd9051b (patch)
tree1d86c625ad92dda7820ce8c68cb1c577938fe216 /test/ruby/test_ast.rb
parenta9284ecb90176b4d8e9aa264da14ea08931be48f (diff)
Squashed commit of the following: [Backport #16516]
commit c98c492578d898dc07a04b8240d8d5b1508ffafa Author: Nobuyoshi Nakada <nobu@ruby-lang.org> Date: Fri Jan 17 16:56:53 2020 +0900 Added test for f38b3e8c707ebdcad05aa9485cf1760640b74fbb commit f38b3e8c707ebdcad05aa9485cf1760640b74fbb Author: Nobuyoshi Nakada <nobu@ruby-lang.org> Date: Thu Jan 16 18:34:31 2020 +0900 Fixed the location of args node with numbered parameter
Diffstat (limited to 'test/ruby/test_ast.rb')
-rw-r--r--test/ruby/test_ast.rb9
1 files changed, 8 insertions, 1 deletions
diff --git a/test/ruby/test_ast.rb b/test/ruby/test_ast.rb
index 4c156650b8..147d05eadf 100644
--- a/test/ruby/test_ast.rb
+++ b/test/ruby/test_ast.rb
@@ -42,10 +42,11 @@ class TestAst < Test::Unit::TestCase
class Helper
attr_reader :errors
- def initialize(path)
+ def initialize(path, src: nil)
@path = path
@errors = []
@debug = false
+ @ast = RubyVM::AbstractSyntaxTree.parse(src) if src
end
def validate_range
@@ -312,4 +313,10 @@ class TestAst < Test::Unit::TestCase
assert_equal(false, kwrest.call('**nil'))
assert_equal([:a], kwrest.call('**a'))
end
+
+ def test_ranges_numbered_parameter
+ helper = Helper.new(__FILE__, src: "1.times {_1}")
+ helper.validate_range
+ assert_equal([], helper.errors)
+ end
end