aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-06-28 23:45:55 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-06-28 23:45:55 +0000
commit620ca670e12ee7f754af7a8c30ef08ad7147dcd2 (patch)
treea0c7dedaaa6526d8ec61196b357415256259f24c /test
parent4bca3851403aabdc4683c27e6c798530dd657c32 (diff)
downloadruby-620ca670e12ee7f754af7a8c30ef08ad7147dcd2.tar.gz
Passed block symbol to proc
* 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/trunk@55531 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_symbol.rb29
1 files changed, 29 insertions, 0 deletions
diff --git a/test/ruby/test_symbol.rb b/test/ruby/test_symbol.rb
index 03934226a1..d8c91c1eea 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