diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-09-24 14:45:19 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-09-24 14:45:19 +0000 |
commit | f5b0cb07e24bddb6c9cef3741cb2d79095ba0e91 (patch) | |
tree | 64ebad80b802a6318f5e409592c8325eda19576e /test/ruby/test_proc.rb | |
parent | 08d2e528aa35ea30087f7e8990e5028f4c2693ab (diff) | |
download | ruby-f5b0cb07e24bddb6c9cef3741cb2d79095ba0e91.tar.gz |
* string.c (sym_call), vm.c (invoke_block_from_c),
vm_insnhelper.c (vm_yield_with_cfunc): pass given block.
[ruby-core:32075]
* vm_eval.c (rb_funcall_passing_block): new function to call
method with passing given block.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29335 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_proc.rb')
-rw-r--r-- | test/ruby/test_proc.rb | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/test/ruby/test_proc.rb b/test/ruby/test_proc.rb index 1a473ae43d..efd5a269fd 100644 --- a/test/ruby/test_proc.rb +++ b/test/ruby/test_proc.rb @@ -800,4 +800,22 @@ class TestProc < Test::Unit::TestCase ensure set_trace_func(nil) end + + def test_block_propagation + bug3792 = '[ruby-core:32075]' + c = Class.new do + def foo + yield + end + end + + o = c.new + f = :foo.to_proc + assert_nothing_raised(LocalJumpError, bug3792) { + assert_equal('bar', f.(o) {'bar'}, bug3792) + } + assert_nothing_raised(LocalJumpError, bug3792) { + assert_equal('zot', o.method(:foo).to_proc.() {'zot'}, bug3792) + } + end end |