aboutsummaryrefslogtreecommitdiffstats
path: root/test/ripper/test_parser_events.rb
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2019-03-17 05:21:18 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2019-03-17 05:21:18 +0000
commit12acc751e3e7fd6f8aec33abf661724ad76c862a (patch)
tree831705cd3fc725d9abb2909036867e6f13cd1df5 /test/ripper/test_parser_events.rb
parent0fa4a6a618295d42eb039c65f0609fdb71255355 (diff)
downloadruby-12acc751e3e7fd6f8aec33abf661724ad76c862a.tar.gz
Numbered parameters [Feature #4475]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67278 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ripper/test_parser_events.rb')
-rw-r--r--test/ripper/test_parser_events.rb11
1 files changed, 10 insertions, 1 deletions
diff --git a/test/ripper/test_parser_events.rb b/test/ripper/test_parser_events.rb
index 0591eeb781..e4860ef533 100644
--- a/test/ripper/test_parser_events.rb
+++ b/test/ripper/test_parser_events.rb
@@ -812,6 +812,12 @@ class TestRipper::ParserEvents < Test::Unit::TestCase
assert_equal true, thru_next
end
+ def test_number_arg
+ thru_number_arg = false
+ parse('proc {@1}', :on_number_arg) {thru_number_arg = true}
+ assert_equal true, thru_number_arg
+ end
+
def test_opassign
thru_opassign = false
tree = parse('a += b', :on_opassign) {thru_opassign = true}
@@ -1477,8 +1483,11 @@ class TestRipper::ParserEvents < Test::Unit::TestCase
assert_equal("unterminated regexp meets end of file", compile_error('/'))
end
+ def test_invalid_numbered_parameter_name
+ assert_equal("leading zero is not allowed as a numbered parameter", compile_error('proc{@0}'))
+ end
+
def test_invalid_instance_variable_name
- assert_equal("`@1' is not allowed as an instance variable name", compile_error('@1'))
assert_equal("`@' without identifiers is not allowed as an instance variable name", compile_error('@%'))
assert_equal("`@' without identifiers is not allowed as an instance variable name", compile_error('@'))
end