diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-12-25 11:28:56 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-12-25 11:28:56 +0000 |
commit | 7fd58845d907d218538a39d829ccb4090c784618 (patch) | |
tree | d030bffc9c40969ceae98ec0e74d1915722fc6bc /test/ruby/test_method.rb | |
parent | c8185b327ea68ce125937c977b2b158a90f27561 (diff) | |
download | ruby-7fd58845d907d218538a39d829ccb4090c784618.tar.gz |
proc.c: fix arity of rest keywords argument
* proc.c (rb_iseq_min_max_arity): maximum argument is unlimited if
having rest keywords argument. [ruby-core:53298] [Bug #8072]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44413 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_method.rb')
-rw-r--r-- | test/ruby/test_method.rb | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/test/ruby/test_method.rb b/test/ruby/test_method.rb index bb6b9ae70b..af29ce59a3 100644 --- a/test/ruby/test_method.rb +++ b/test/ruby/test_method.rb @@ -23,6 +23,13 @@ class TestMethod < Test::Unit::TestCase def mo6(a, *b, c, &d) end def mo7(a, b = nil, *c, d, &e) end def ma1((a), &b) nil && a end + def mk1(**) end + def mk2(**o) nil && o end + def mk3(a, **o) nil && o end + def mk4(a = nil, **o) nil && o end + def mk5(a, b = nil, **o) nil && o end + def mk6(a, b = nil, c, **o) nil && o end + def mk7(a, b = nil, *c, d, **o) nil && o end class Base def foo() :base end @@ -68,6 +75,13 @@ class TestMethod < Test::Unit::TestCase assert_equal(-2, method(:mo4).arity) assert_equal(-3, method(:mo5).arity) assert_equal(-3, method(:mo6).arity) + assert_equal(-1, method(:mk1).arity) + assert_equal(-1, method(:mk2).arity) + assert_equal(-2, method(:mk3).arity) + assert_equal(-1, method(:mk4).arity) + assert_equal(-2, method(:mk5).arity) + assert_equal(-3, method(:mk6).arity) + assert_equal(-3, method(:mk7).arity) end def test_arity_special @@ -457,6 +471,13 @@ class TestMethod < Test::Unit::TestCase define_method(:pmo6) {|a, *b, c, &d|} define_method(:pmo7) {|a, b = nil, *c, d, &e|} define_method(:pma1) {|(a), &b| nil && a} + define_method(:pmk1) {|**|} + define_method(:pmk2) {|**o|} + define_method(:pmk3) {|a, **o|} + define_method(:pmk4) {|a = nil, **o|} + define_method(:pmk5) {|a, b = nil, **o|} + define_method(:pmk6) {|a, b = nil, c, **o|} + define_method(:pmk7) {|a, b = nil, *c, d, **o|} def test_bound_parameters assert_equal([], method(:m0).parameters) |