1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* 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
This commit is contained in:
nobu 2008-10-25 09:47:54 +00:00
parent 5106742893
commit 520f1372e3
2 changed files with 18 additions and 0 deletions

View file

@ -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

View file

@ -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'