summaryrefslogtreecommitdiff
path: root/test/ripper/test_parser_events.rb
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-01-04 12:32:54 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-01-04 12:32:54 +0000
commit3977fd332f26c44afeb2f3c950be6af358ac294d (patch)
tree6497096d0c91dd236b0cb292d69d27bfccf94696 /test/ripper/test_parser_events.rb
parentb9c630f999e36ce3d2b3c80375e6716bfca0dfb8 (diff)
parse.y: fix f_label result
* parse.y (f_label): return tLABEL value as it is. [ruby-core:67315] [Bug #10693] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49140 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ripper/test_parser_events.rb')
-rw-r--r--test/ripper/test_parser_events.rb22
1 files changed, 19 insertions, 3 deletions
diff --git a/test/ripper/test_parser_events.rb b/test/ripper/test_parser_events.rb
index 883684a..08296a2 100644
--- a/test/ripper/test_parser_events.rb
+++ b/test/ripper/test_parser_events.rb
@@ -751,15 +751,31 @@ class TestRipper::ParserEvents < Test::Unit::TestCase
end
def test_params
+ arg = nil
thru_params = false
- parse('a {||}', :on_params) {thru_params = true}
+ parse('a {||}', :on_params) {|_, *v| thru_params = true; arg = v}
assert_equal true, thru_params
+ assert_equal [nil, nil, nil, nil, nil, nil, nil], arg
thru_params = false
- parse('a {|x|}', :on_params) {thru_params = true}
+ parse('a {|x|}', :on_params) {|_, *v| thru_params = true; arg = v}
assert_equal true, thru_params
+ assert_equal [["x"], nil, nil, nil, nil, nil, nil], arg
thru_params = false
- parse('a {|*x|}', :on_params) {thru_params = true}
+ parse('a {|*x|}', :on_params) {|_, *v| thru_params = true; arg = v}
assert_equal true, thru_params
+ assert_equal [nil, nil, "*x", nil, nil, nil, nil], arg
+ thru_params = false
+ parse('a {|x: 1|}', :on_params) {|_, *v| thru_params = true; arg = v}
+ assert_equal true, thru_params
+ assert_equal [nil, nil, nil, nil, [["x:", "1"]], nil, nil], arg
+ thru_params = false
+ parse('a {|x:|}', :on_params) {|_, *v| thru_params = true; arg = v}
+ assert_equal true, thru_params
+ assert_equal [nil, nil, nil, nil, [["x:", false]], nil, nil], arg
+ thru_params = false
+ parse('a {|**x|}', :on_params) {|_, *v| thru_params = true; arg = v}
+ assert_equal true, thru_params
+ assert_equal [nil, nil, nil, nil, nil, "x", nil], arg
end
def test_paren