diff options
author | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-03-19 14:29:22 +0000 |
---|---|---|
committer | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-03-19 14:29:22 +0000 |
commit | dd6be57da8054b95855c01d1ebedd21d4a91cd68 (patch) | |
tree | a63b94545933578b040fe51ae248b8c04fbaa657 /test | |
parent | 8be9bd482eee91c503f623bb3b802c9fa8e371b2 (diff) |
merge revision(s) 58015: [Backport #13325]
vm_args.c: pass block
* vm_args.c (refine_sym_proc_call): pass block to the method when
using refinements. [ruby-core:80219] [Bug #13325]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_4@58022 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_refinement.rb | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/test/ruby/test_refinement.rb b/test/ruby/test_refinement.rb index a178f24591..f6e08729d7 100644 --- a/test/ruby/test_refinement.rb +++ b/test/ruby/test_refinement.rb @@ -1769,6 +1769,31 @@ class TestRefinement < Test::Unit::TestCase assert_equal("Foo#x", FooExtClient.return_proc(&:x).(Foo.new)) end + def test_symbol_proc_with_block + assert_separately([], "#{<<~"begin;"}\n#{<<~'end;'}") + bug = '[ruby-core:80219] [Bug #13325]' + begin; + module M + refine Class.new do + end + end + class C + def call(a, x, &b) + b.call(a, &x) + end + end + o = C.new + r = nil + x = ->(z){r = z} + assert_equal(42, o.call(42, x, &:tap)) + assert_equal(42, r) + using M + r = nil + assert_equal(42, o.call(42, x, &:tap), bug) + assert_equal(42, r, bug) + end; + end + module AliasInSubclass class C def foo |