summaryrefslogtreecommitdiff
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
commit86a756ae154ff42da39af1a5358506fca11e0946 (patch)
treea0c7dedaaa6526d8ec61196b357415256259f24c /test
parente3503ee218d8b6ca4dfa95414fe5d83b52104476 (diff)
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