mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* eval.c (proc_eq): avoid false positive by using scope and
dyna_vars. no longer use frame.uniq.
* eval.c (proc_arity): arity is now defined as number of
parameters that would not be ignored. i.e. Proc.new{}.arity
returns zero. update test suites too.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5972 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
311fdfdfea
commit
c223709c3b
6 changed files with 18 additions and 9 deletions
|
|
@ -50,7 +50,7 @@ class TestProc < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
def test_arity
|
||||
assert_equal(-1, proc{}.arity)
|
||||
assert_equal(0, proc{}.arity)
|
||||
assert_equal(0, proc{||}.arity)
|
||||
assert_equal(1, proc{|x|}.arity)
|
||||
assert_equal(2, proc{|x, y|}.arity)
|
||||
|
|
@ -58,7 +58,7 @@ class TestProc < Test::Unit::TestCase
|
|||
assert_equal(-1, proc{|*x|}.arity)
|
||||
assert_equal(-1, proc{|*|}.arity)
|
||||
|
||||
assert_arity(-1) {}
|
||||
assert_arity(0) {}
|
||||
assert_arity(0) {||}
|
||||
assert_arity(1) {|x|}
|
||||
assert_arity(2) {|x, y|}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue