summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-06-08 02:08:00 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-06-08 02:08:00 +0000
commit9a4a04fe15a2d71ec3661b37fcf7285a99ad778d (patch)
tree9d3b2f7f318e937e2e4fa2d23807aca1247bcf11
parentb5960a63b1769e114c4d674140aa5f18a33eef27 (diff)
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.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/test/ruby/test_proc.rb b/test/ruby/test_proc.rb
index 84055cad60c..58a2b17643b 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