aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-08-23 04:01:39 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-08-23 04:01:39 +0000
commitbc89cb711baf1459c7037164d15cfb2217e280e1 (patch)
tree50a76c204eeac144a58da9fb61f0e9561033b73d /test
parent279c325890b496bf0caf13804d814d3b83816192 (diff)
downloadruby-bc89cb711baf1459c7037164d15cfb2217e280e1.tar.gz
gc.c: restore cfp at finalizer
* gc.c (run_finalizer): restore cfp for the case an exception raised in a finalizer. [ruby-core:82432] [Bug #13832] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59649 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_gc.rb23
1 files changed, 23 insertions, 0 deletions
diff --git a/test/ruby/test_gc.rb b/test/ruby/test_gc.rb
index fa4d779069..f72a59aaf8 100644
--- a/test/ruby/test_gc.rb
+++ b/test/ruby/test_gc.rb
@@ -420,4 +420,27 @@ class TestGc < Test::Unit::TestCase
skip "finalizers did not get run" if result.empty?
assert_equal([:c1, :c2], result)
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