summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authornagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-07-01 18:59:06 +0000
committernagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-07-01 18:59:06 +0000
commit62586a95d39a92d7c96b711919955b72c8ac5ecf (patch)
tree5ebd92414a2a91f4282b387499fe3d7c4039a934 /test
parenta11bb4fa91f520847afcdc6e56b44a904564f4d9 (diff)
merge revision(s) 55462: [Backport #11954]
* vm.c (invoke_bmethod, invoke_block_from_c_0): revert r52104 partially to avoid "self has wrong type to call super in this context" errors. [ruby-core:72724] [Bug #11954] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_3@55560 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_objectspace.rb46
1 files changed, 46 insertions, 0 deletions
diff --git a/test/ruby/test_objectspace.rb b/test/ruby/test_objectspace.rb
index ec561bc405..b2ab817fba 100644
--- a/test/ruby/test_objectspace.rb
+++ b/test/ruby/test_objectspace.rb
@@ -85,6 +85,52 @@ End
}
end
+ def test_finalizer_with_super
+ assert_in_out_err(["-e", <<-END], "", %w(:ok), [])
+ class A
+ def foo
+ end
+ end
+
+ class B < A
+ def foo
+ 1.times { super }
+ end
+ end
+
+ class C
+ module M
+ end
+
+ FINALIZER = proc do
+ M.module_eval do
+ end
+ end
+
+ def define_finalizer
+ ObjectSpace.define_finalizer(self, FINALIZER)
+ end
+ end
+
+ class D
+ def foo
+ B.new.foo
+ end
+ end
+
+ C::M.singleton_class.send :define_method, :module_eval do |src, id, line|
+ end
+
+ GC.stress = true
+ 10.times do
+ C.new.define_finalizer
+ D.new.foo
+ end
+
+ p :ok
+ END
+ end
+
def test_each_object
klass = Class.new
new_obj = klass.new