diff options
author | nagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-07-30 03:21:51 +0000 |
---|---|---|
committer | nagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-07-30 03:21:51 +0000 |
commit | 446bb33fa30f6339b3c20a36db0280315621dfd1 (patch) | |
tree | 27918189b034b20e66cb814aaca5a498e295f499 /test | |
parent | e561fc44a4cc28984ad5b8f484214df5a7b02ca3 (diff) |
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
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_symbol.rb | 29 |
1 files changed, 29 insertions, 0 deletions
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 |