diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-08-23 02:26:02 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-08-23 02:26:02 +0000 |
commit | 0f711026e2da7ebcd8933c987d8b0a835f1ae153 (patch) | |
tree | d57544dd3e014b5fcc89b901592745e3e94ca923 /test/ruby/test_gc.rb | |
parent | e96ba1d647a27f81ae35fe4ae117e71a7401d3c4 (diff) | |
download | ruby-0f711026e2da7ebcd8933c987d8b0a835f1ae153.tar.gz |
gc.c: run all finalizers
* gc.c (run_finalizer): revert r59155 partially. finalizing loop
should continue even after an exception is rescued.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59647 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_gc.rb')
-rw-r--r-- | test/ruby/test_gc.rb | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/test/ruby/test_gc.rb b/test/ruby/test_gc.rb index a5fd2897a2..2e26fde5c1 100644 --- a/test/ruby/test_gc.rb +++ b/test/ruby/test_gc.rb @@ -397,4 +397,26 @@ class TestGc < Test::Unit::TestCase ObjectSpace.each_object{|o| case o when Module then o.instance_methods end} end end + + def test_exception_in_finalizer + result = [] + c1 = proc do + result << :c1 + raise + end + c2 = proc do + result << :c2 + raise + end + tap { + tap { + obj = Object.new + ObjectSpace.define_finalizer(obj, c1) + ObjectSpace.define_finalizer(obj, c2) + obj = nil + } + } + GC.start + assert_equal([:c1, :c2], result) + end end |