diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-12-25 11:30:15 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-12-25 11:30:15 +0000 |
commit | 4398093755824d8aa24095e97c70c5b700989362 (patch) | |
tree | 71c50337467e2fea2ef58b8f6a2a48ef277e5238 /test/ruby/test_proc.rb | |
parent | 7fd58845d907d218538a39d829ccb4090c784618 (diff) | |
download | ruby-4398093755824d8aa24095e97c70c5b700989362.tar.gz |
iseq.c: fix parameter of unnamed rest keywords argument
* iseq.c (rb_iseq_parameters): push argument type symbol only for
unnamed rest keywords argument.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44414 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_proc.rb')
-rw-r--r-- | test/ruby/test_proc.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/test/ruby/test_proc.rb b/test/ruby/test_proc.rb index 7dd93bee9d..206e21fb1a 100644 --- a/test/ruby/test_proc.rb +++ b/test/ruby/test_proc.rb @@ -1104,6 +1104,13 @@ class TestProc < Test::Unit::TestCase def pmo6(a, *b, c, &d) end def pmo7(a, b = :b, *c, d, &e) end def pma1((a), &b) a; end + def pmk1(**) end + def pmk2(**o) nil && o end + def pmk3(a, **o) nil && o end + def pmk4(a = nil, **o) nil && o end + def pmk5(a, b = nil, **o) nil && o end + def pmk6(a, b = nil, c, **o) nil && o end + def pmk7(a, b = nil, *c, d, **o) nil && o end def test_bound_parameters @@ -1118,6 +1125,13 @@ class TestProc < Test::Unit::TestCase assert_equal([[:req, :a], [:rest, :b], [:req, :c], [:block, :d]], method(:pmo6).to_proc.parameters) assert_equal([[:req, :a], [:opt, :b], [:rest, :c], [:req, :d], [:block, :e]], method(:pmo7).to_proc.parameters) assert_equal([[:req], [:block, :b]], method(:pma1).to_proc.parameters) + assert_equal([[:keyrest]], method(:pmk1).to_proc.parameters) + assert_equal([[:keyrest, :o]], method(:pmk2).to_proc.parameters) + assert_equal([[:req, :a], [:keyrest, :o]], method(:pmk3).to_proc.parameters) + assert_equal([[:opt, :a], [:keyrest, :o]], method(:pmk4).to_proc.parameters) + assert_equal([[:req, :a], [:opt, :b], [:keyrest, :o]], method(:pmk5).to_proc.parameters) + assert_equal([[:req, :a], [:opt, :b], [:req, :c], [:keyrest, :o]], method(:pmk6).to_proc.parameters) + assert_equal([[:req, :a], [:opt, :b], [:rest, :c], [:req, :d], [:keyrest, :o]], method(:pmk7).to_proc.parameters) assert_equal([], "".method(:upcase).to_proc.parameters) assert_equal([[:rest]], "".method(:gsub).to_proc.parameters) |