summaryrefslogtreecommitdiff
path: root/test/ruby/test_gc.rb
diff options
context:
space:
mode:
authorwanabe <wanabe@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-12-30 14:17:32 +0000
committerwanabe <wanabe@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-12-30 14:17:32 +0000
commitaf8df10d3b8b58d934b3603211d2ec9043098b3b (patch)
treeb9229885a1cb5132c309def76f2aed5c916a9428 /test/ruby/test_gc.rb
parent962b75384e4b6b388806fa3ff8d4381a2329ccb4 (diff)
* vm.c (vm_define_method): guard iseq from GC while method definition.
[ruby-dev:42832] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30432 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_gc.rb')
-rw-r--r--test/ruby/test_gc.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/ruby/test_gc.rb b/test/ruby/test_gc.rb
index 039240f1e0..32b6e9f481 100644
--- a/test/ruby/test_gc.rb
+++ b/test/ruby/test_gc.rb
@@ -63,4 +63,19 @@ class TestGc < Test::Unit::TestCase
assert_equal(false, res.empty?)
assert_kind_of(Integer, res[:count])
end
+
+ def test_singleton_method
+ prev_stress = GC.stress
+ assert_nothing_raised("[ruby-dev:42832]") do
+ GC.stress = true
+ 10.times do
+ obj = Object.new
+ def obj.foo() end
+ def obj.bar() raise "obj.foo is called, but this is obj.bar" end
+ obj.foo
+ end
+ end
+ ensure
+ GC.stress = prev_stress
+ end
end