diff options
Diffstat (limited to 'test/ruby/test_gc.rb')
-rw-r--r-- | test/ruby/test_gc.rb | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/test/ruby/test_gc.rb b/test/ruby/test_gc.rb index a5fd2897a2..5b85d3d8d9 100644 --- a/test/ruby/test_gc.rb +++ b/test/ruby/test_gc.rb @@ -397,4 +397,27 @@ 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_method + @result = [] + def self.c1(x) + @result << :c1 + raise + end + def self.c2(x) + @result << :c2 + raise + end + tap { + tap { + obj = Object.new + ObjectSpace.define_finalizer(obj, method(:c1)) + ObjectSpace.define_finalizer(obj, method(:c2)) + obj = nil + } + } + GC.start + skip "finalizers did not get run" if @result.empty? + assert_equal([:c1, :c2], @result) + end end |