diff options
Diffstat (limited to 'test/ruby/test_gc.rb')
-rw-r--r-- | test/ruby/test_gc.rb | 15 |
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 |