mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* yarvcore.h, compile.c (set_arguments): support post arguments.
* test/ruby/test_method.rb: add tests for above. * test/ruby/test_proc.rb: ditto. * proc.c: fix an arity bug ([ruby-core:11029]). * vm.c, vm.h, insns.def, vm_dump.h: fix bmethod process. * vm.c: support block argument on block parameter. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12231 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
ea2cb282ae
commit
75d28f8870
12 changed files with 148 additions and 44 deletions
|
@ -57,12 +57,15 @@ class TestProc < Test::Unit::TestCase
|
|||
assert_equal(-2, proc{|x, *y|}.arity)
|
||||
assert_equal(-1, proc{|*x|}.arity)
|
||||
assert_equal(-1, proc{|*|}.arity)
|
||||
assert_equal(-3, proc{|x, *y, z|}.arity)
|
||||
assert_equal(-4, proc{|x, *y, z, a|}.arity)
|
||||
|
||||
assert_arity(0) {}
|
||||
assert_arity(0) {||}
|
||||
assert_arity(1) {|x|}
|
||||
assert_arity(2) {|x, y|}
|
||||
assert_arity(-2) {|x, *y|}
|
||||
assert_arity(-3) {|x, *y, z|}
|
||||
assert_arity(-1) {|*x|}
|
||||
assert_arity(-1) {|*|}
|
||||
end
|
||||
|
@ -89,9 +92,8 @@ class TestProc < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
def test_block_par
|
||||
assert false, "TODO: block parameter |&b| not supported"
|
||||
# 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})
|
||||
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
|
||||
|
||||
def test_safe
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue