[前][次][番号順一覧][スレッド一覧]

ruby-changes:43247

From: nobu <ko1@a...>
Date: Wed, 8 Jun 2016 11:08:06 +0900 (JST)
Subject: [ruby-changes:43247] nobu:r55321 (trunk): test_proc.rb: test_lambda?

nobu	2016-06-08 11:08:00 +0900 (Wed, 08 Jun 2016)

  New Revision: 55321

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=55321

  Log:
    test_proc.rb: test_lambda?
    
    * test/ruby/test_proc.rb (test_lambda?): lambda-ness should be
      preserved across proc, lambda, and Proc.new.

  Modified files:
    trunk/test/ruby/test_proc.rb
Index: test/ruby/test_proc.rb
===================================================================
--- test/ruby/test_proc.rb	(revision 55320)
+++ test/ruby/test_proc.rb	(revision 55321)
@@ -281,13 +281,21 @@ class TestProc < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_proc.rb#L281
     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

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]