summaryrefslogtreecommitdiff
path: root/test/ruby
diff options
context:
space:
mode:
Diffstat (limited to 'test/ruby')
-rw-r--r--test/ruby/test_ast.rb9
-rw-r--r--test/ruby/test_syntax.rb2
2 files changed, 10 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
diff --git a/test/ruby/test_syntax.rb b/test/ruby/test_syntax.rb
index 72f539068d..21b0bc7ce7 100644
--- a/test/ruby/test_syntax.rb
+++ b/test/ruby/test_syntax.rb
@@ -1451,6 +1451,8 @@ eom
assert_valid_syntax("->{#{c};->{_1};end;_1}\n")
assert_valid_syntax("->{_1;#{c};->{_1};end}\n")
end
+
+ 1.times {_1}
end
def test_value_expr_in_condition