summaryrefslogtreecommitdiff
path: root/test/ripper
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2019-09-04 00:07:50 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2019-09-24 21:57:54 +0900
commitea68bb914a3c806a1c5188993b96791a76ab0849 (patch)
tree085fe4bbf44e546143ba2ee950298bf269785d7a /test/ripper
parente73cc3eead75b27eabf93a7163bed511f2bb3b17 (diff)
Changed numbered parameter prefix
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/2431
Diffstat (limited to 'test/ripper')
-rw-r--r--test/ripper/test_lexer.rb8
-rw-r--r--test/ripper/test_parser_events.rb10
-rw-r--r--test/ripper/test_scanner_events.rb7
3 files changed, 9 insertions, 16 deletions
diff --git a/test/ripper/test_lexer.rb b/test/ripper/test_lexer.rb
index 060d5f2db9..1794773d89 100644
--- a/test/ripper/test_lexer.rb
+++ b/test/ripper/test_lexer.rb
@@ -102,15 +102,15 @@ class TestRipper::Lexer < Test::Unit::TestCase
def test_state_after_ivar
assert_equal [[1,0],:on_ivar,"@a",state(:EXPR_END)], Ripper.lex("@a").last
assert_equal [[1,1],:on_ivar,"@a",state(:EXPR_ENDFN)], Ripper.lex(":@a").last
- assert_equal [[1,0],:on_ivar,"@1",state(:EXPR_END)], Ripper.lex("@1").last
- assert_equal [[1,1],:on_ivar,"@1",state(:EXPR_ENDFN)], Ripper.lex(":@1").last
+ assert_equal [[1,1],:on_int,"1",state(:EXPR_END)], Ripper.lex("@1").last
+ assert_equal [[1,2],:on_int,"1",state(:EXPR_END)], Ripper.lex(":@1").last
end
def test_state_after_cvar
assert_equal [[1,0],:on_cvar,"@@a",state(:EXPR_END)], Ripper.lex("@@a").last
assert_equal [[1,1],:on_cvar,"@@a",state(:EXPR_ENDFN)], Ripper.lex(":@@a").last
- assert_equal [[1,0],:on_cvar,"@@1",state(:EXPR_END)], Ripper.lex("@@1").last
- assert_equal [[1,1],:on_cvar,"@@1",state(:EXPR_ENDFN)], Ripper.lex(":@@1").last
+ assert_equal [[1,2],:on_int,"1",state(:EXPR_END)], Ripper.lex("@@1").last
+ assert_equal [[1,3],:on_int,"1",state(:EXPR_END)], Ripper.lex(":@@1").last
end
def test_token_aftr_error_heredoc
diff --git a/test/ripper/test_parser_events.rb b/test/ripper/test_parser_events.rb
index 1bae1e31ad..662ab3d7fe 100644
--- a/test/ripper/test_parser_events.rb
+++ b/test/ripper/test_parser_events.rb
@@ -58,7 +58,10 @@ class TestRipper::ParserEvents < Test::Unit::TestCase
assert_equal '[assign(var_field(a),ref(a))]', parse('a=a')
assert_equal '[ref(nil)]', parse('nil')
assert_equal '[ref(true)]', parse('true')
- assert_include parse('proc{@1}'), '[ref(@1)]'
+ assert_equal '[vcall(_0)]', parse('_0')
+ assert_equal '[vcall(_1)]', parse('_1')
+ assert_include parse('proc{_0}'), '[ref(_0)]'
+ assert_include parse('proc{_1}'), '[ref(_1)]'
end
def test_vcall
@@ -1505,11 +1508,8 @@ 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('proc{@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
diff --git a/test/ripper/test_scanner_events.rb b/test/ripper/test_scanner_events.rb
index 75ae29491d..641310b384 100644
--- a/test/ripper/test_scanner_events.rb
+++ b/test/ripper/test_scanner_events.rb
@@ -360,13 +360,6 @@ class TestRipper::ScannerEvents < Test::Unit::TestCase
scan('ivar', 'm(lvar, @ivar, @@cvar, $gvar)')
end
- def test_tnumparam
- assert_equal [],
- scan('tnumparam', '')
- assert_equal ['@1'],
- scan('tnumparam', 'proc {@1}')
- end
-
def test_kw
assert_equal [],
scan('kw', '')