From 446bb33fa30f6339b3c20a36db0280315621dfd1 Mon Sep 17 00:00:00 2001 From: nagachika Date: Sat, 30 Jul 2016 03:21:51 +0000 Subject: merge revision(s) 54909,55531: [Backport #12531] proc.c: passed_block * proc.c (passed_block): extract conversion from passed proc value to rb_block_t pointer. * proc.c (passed_block): convert passed block symbol to proc. based on the patch by Daisuke Sato in [ruby-dev:49695]. [Bug #12531] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_3@55778 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_symbol.rb | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'test') diff --git a/test/ruby/test_symbol.rb b/test/ruby/test_symbol.rb index 540661afc0..ce3b0d652f 100644 --- a/test/ruby/test_symbol.rb +++ b/test/ruby/test_symbol.rb @@ -229,6 +229,35 @@ class TestSymbol < Test::Unit::TestCase assert_equal([false, false], m2.call(self, m2), "#{bug8531} nested without block") end + def test_block_curry_proc + assert_separately([], "#{<<-"begin;"}\n#{<<-"end;"}") + begin; + b = proc { true }.curry + assert(b.call, "without block") + assert(b.call { |o| o.to_s }, "with block") + assert(b.call(&:to_s), "with sym block") + end; + end + + def test_block_curry_lambda + assert_separately([], "#{<<-"begin;"}\n#{<<-"end;"}") + begin; + b = lambda { true }.curry + assert(b.call, "without block") + assert(b.call { |o| o.to_s }, "with block") + assert(b.call(&:to_s), "with sym block") + end; + end + + def test_block_method_to_proc + assert_separately([], "#{<<-"begin;"}\n#{<<-"end;"}") + begin; + b = method(:tap).to_proc + assert(b.call { |o| o.to_s }, "with block") + assert(b.call(&:to_s), "with sym block") + end; + end + def test_succ assert_equal(:fop, :foo.succ) end -- cgit v1.2.3