diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-10-25 09:47:54 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-10-25 09:47:54 +0000 |
commit | 520f1372e3052fc46968b3914c7a31680584327a (patch) | |
tree | 9c25e49102df425eae7fe9becb444aeaa30ebf03 /test/ruby | |
parent | 51067428932e6244b7127ba41a9c82ade9904a40 (diff) | |
download | ruby-520f1372e3052fc46968b3914c7a31680584327a.tar.gz |
* test/ruby/test_proc.rb (test_proc_args_unleashed): test for
[ruby-core:19485].
* test/ruby/test_yield.rb (test_block_args_unleashed): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19933 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby')
-rw-r--r-- | test/ruby/test_proc.rb | 7 | ||||
-rw-r--r-- | test/ruby/test_yield.rb | 11 |
2 files changed, 18 insertions, 0 deletions
diff --git a/test/ruby/test_proc.rb b/test/ruby/test_proc.rb index ee53eeaf3a..8d2521b02f 100644 --- a/test/ruby/test_proc.rb +++ b/test/ruby/test_proc.rb @@ -309,4 +309,11 @@ class TestProc < Test::Unit::TestCase def test_binding2 assert_raise(ArgumentError) { proc {}.curry.binding } end + + def test_proc_args_unleashed + r = proc {|a,b=1,*c,d,e| + [a,b,c,d,e] + }.call(1,2,3,4,5) + assert_equal([1,2,[3],4,5], r, "[ruby-core:19485]") + end end diff --git a/test/ruby/test_yield.rb b/test/ruby/test_yield.rb index 452c17b141..2a2c6ae80f 100644 --- a/test/ruby/test_yield.rb +++ b/test/ruby/test_yield.rb @@ -72,6 +72,17 @@ class TestRubyYield < Test::Unit::TestCase obj.each{|*v| assert_equal([], [], '[ruby-dev:32392]')} obj.to_enum.each{|*v| assert_equal([], [], '[ruby-dev:32392]')} end + + def block_args_unleashed + yield(1,2,3,4,5) + end + + def test_block_args_unleashed + r = block_args_unleashed {|a,b=1,*c,d,e| + [a,b,c,d,e] + } + assert_equal([1,2,[3],4,5], r, "[ruby-core:19485]") + end end require_relative 'sentence' |