mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* eval.c (rb_yield_0, proc_invoke, proc_arity): allow passing a block
to a Proc. [ruby-dev:23533] * parse.y (block_par, block_var): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6402 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
1efe963c7a
commit
82572952ec
5 changed files with 186 additions and 28 deletions
|
@ -86,4 +86,9 @@ class TestProc < Test::Unit::TestCase
|
|||
b = lambda {}
|
||||
assert_not_equal(a, b)
|
||||
end
|
||||
|
||||
def test_block_par
|
||||
assert_equal(10, Proc.new{|&b| b.call(10)}.call {|x| x})
|
||||
assert_equal(12, Proc.new{|a,&b| b.call(a)}.call(12) {|x| x})
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue