summaryrefslogtreecommitdiff
path: root/test/ripper/test_sexp.rb
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-07-01 02:01:05 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-07-01 02:01:05 +0000
commitf2d18484417fdc6e9ae4970fed7eda0de1027e91 (patch)
tree9f5586a5e6d5538834c4683b293b8c06874f1b83 /test/ripper/test_sexp.rb
parent844ca35a924ed2ff0de48f0e4680f05f8da234bf (diff)
parse.y: f_margs parser events
* parse.y (f_margs): implemented parser events for massign formal arguments. [ruby-core:81848] [Bug #13701] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59246 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ripper/test_sexp.rb')
-rw-r--r--test/ripper/test_sexp.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/ripper/test_sexp.rb b/test/ripper/test_sexp.rb
index 26d19b1..d3afbb2 100644
--- a/test/ripper/test_sexp.rb
+++ b/test/ripper/test_sexp.rb
@@ -60,6 +60,21 @@ eot
assert_equal clear_pos(sexp1), clear_pos(sexp2)
end
+ def test_params_mlhs
+ sexp = Ripper.sexp("proc {|(w, *x, y), z|}")
+ _, ((mlhs, w, (rest, x), y), z) = search_sexp(:params, sexp)
+ assert_equal(:mlhs, mlhs)
+ assert_equal(:@ident, w[0])
+ assert_equal("w", w[1])
+ assert_equal(:rest_param, rest)
+ assert_equal(:@ident, x[0])
+ assert_equal("x", x[1])
+ assert_equal(:@ident, y[0])
+ assert_equal("y", y[1])
+ assert_equal(:@ident, z[0])
+ assert_equal("z", z[1])
+ end
+
def search_sexp(sym, sexp)
return sexp if !sexp or sexp[0] == sym
sexp.find do |e|