ruby-changes:45170
From: nobu <ko1@a...>
Date: Sun, 1 Jan 2017 17:22:07 +0900 (JST)
Subject: [ruby-changes:45170] nobu:r57243 (trunk): passed block should keep the lambda-ness
nobu 2017-01-01 17:22:02 +0900 (Sun, 01 Jan 2017) New Revision: 57243 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=57243 Log: passed block should keep the lambda-ness Modified files: trunk/test/-ext-/iter/test_yield_block.rb Index: test/-ext-/iter/test_yield_block.rb =================================================================== --- test/-ext-/iter/test_yield_block.rb (revision 57242) +++ test/-ext-/iter/test_yield_block.rb (revision 57243) @@ -12,6 +12,12 @@ class TestIter::YieldBlock < Test::Unit: https://github.com/ruby/ruby/blob/trunk/test/-ext-/iter/test_yield_block.rb#L12 def test(arg, &block) block.call(arg) {|blockarg| @blockarg = blockarg} end + def call_proc(&block) + block.call {} + end + def call_lambda(&block) + block.call &->{} + end end def test_yield_block @@ -19,4 +25,10 @@ class TestIter::YieldBlock < Test::Unit: https://github.com/ruby/ruby/blob/trunk/test/-ext-/iter/test_yield_block.rb#L25 a.yield_block(:test, "foo") {|x, &b| assert_kind_of(Proc, b); b.call(x)} assert_equal("foo", a.blockarg) end + + def test_yield_lambda + a = YieldTest.new + assert_not_predicate a.yield_block(:call_proc) {|&b| b}, :lambda? + assert_predicate a.yield_block(:call_lambda) {|&b| b}, :lambda? + end end -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/