mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
test_proc.rb: test_lambda?
* test/ruby/test_proc.rb (test_lambda?): lambda-ness should be preserved across proc, lambda, and Proc.new. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55321 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
b5960a63b1
commit
9a4a04fe15
1 changed files with 8 additions and 0 deletions
|
@ -281,13 +281,21 @@ class TestProc < Test::Unit::TestCase
|
||||||
b = b.call(2) { raise }
|
b = b.call(2) { raise }
|
||||||
b = b.call(3) {|x| x + 4 }
|
b = b.call(3) {|x| x + 4 }
|
||||||
assert_equal(9, b)
|
assert_equal(9, b)
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_lambda?
|
||||||
l = proc {}
|
l = proc {}
|
||||||
assert_equal(false, l.lambda?)
|
assert_equal(false, l.lambda?)
|
||||||
assert_equal(false, l.curry.lambda?, '[ruby-core:24127]')
|
assert_equal(false, l.curry.lambda?, '[ruby-core:24127]')
|
||||||
|
assert_equal(false, proc(&l).lambda?)
|
||||||
|
assert_equal(false, lambda(&l).lambda?)
|
||||||
|
assert_equal(false, Proc.new(&l).lambda?)
|
||||||
l = lambda {}
|
l = lambda {}
|
||||||
assert_equal(true, l.lambda?)
|
assert_equal(true, l.lambda?)
|
||||||
assert_equal(true, l.curry.lambda?, '[ruby-core:24127]')
|
assert_equal(true, l.curry.lambda?, '[ruby-core:24127]')
|
||||||
|
assert_equal(true, proc(&l).lambda?)
|
||||||
|
assert_equal(true, lambda(&l).lambda?)
|
||||||
|
assert_equal(true, Proc.new(&l).lambda?)
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_curry_ski_fib
|
def test_curry_ski_fib
|
||||||
|
|
Loading…
Reference in a new issue