diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-06-08 02:08:00 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-06-08 02:08:00 +0000 |
commit | 9a4a04fe15a2d71ec3661b37fcf7285a99ad778d (patch) | |
tree | 9d3b2f7f318e937e2e4fa2d23807aca1247bcf11 | |
parent | b5960a63b1769e114c4d674140aa5f18a33eef27 (diff) | |
download | ruby-9a4a04fe15a2d71ec3661b37fcf7285a99ad778d.tar.gz |
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
-rw-r--r-- | test/ruby/test_proc.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/test/ruby/test_proc.rb b/test/ruby/test_proc.rb index 84055cad60..58a2b17643 100644 --- a/test/ruby/test_proc.rb +++ b/test/ruby/test_proc.rb @@ -281,13 +281,21 @@ class TestProc < Test::Unit::TestCase b = b.call(2) { raise } b = b.call(3) {|x| x + 4 } assert_equal(9, b) + end + def test_lambda? l = proc {} assert_equal(false, l.lambda?) 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 {} assert_equal(true, l.lambda?) 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 def test_curry_ski_fib |