diff options
Diffstat (limited to 'test/test_raindrops_gc.rb')
-rw-r--r-- | test/test_raindrops_gc.rb | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/test/test_raindrops_gc.rb b/test/test_raindrops_gc.rb index a1fc3de..209b4ed 100644 --- a/test/test_raindrops_gc.rb +++ b/test/test_raindrops_gc.rb @@ -13,4 +13,25 @@ class TestRaindropsGc < Test::Unit::TestCase end end + def test_gc_postfork + tmp = Raindrops.new 2 + pid = fork do + 1000000.times do + tmp = Raindrops.new 2 + tmp.to_ary + end + end + _, status = Process.waitpid2(pid) + assert status.success? + assert_equal [ 0, 0 ], tmp.to_ary + tmp.incr 1 + assert_equal [ 0, 1 ], tmp.to_ary + pid = fork do + tmp.incr 1 + exit([ 0, 2 ] == tmp.to_ary) + end + _, status = Process.waitpid2(pid) + assert status.success? + assert_equal [ 0, 2 ], tmp.to_ary + end end |