Sha256: 692a83b9937e7b5698048b0549c0b693089331f9016a6b00c074f4f0712ec702

Contents?: true

Size: 958 Bytes

Versions: 26

Compression:

Stored size: 958 Bytes

Contents

# -*- encoding: binary -*-
require 'test/unit'
require 'raindrops'

class TestRaindropsGc < Test::Unit::TestCase

  # we may need to create more garbage as GC may be less aggressive
  # about expiring things.  This is completely unrealistic code,
  # though...
  def test_gc
    assert_nothing_raised do
      1000000.times { |i| Raindrops.new(24); [] }
    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 if !defined?(RUBY_ENGINE) || RUBY_ENGINE == "ruby" &&
       ENV["STRESS"].to_i != 0

Version data entries

26 entries across 26 versions & 3 rubygems

Version Path
raindrops-maintained-0.21.0 test/test_raindrops_gc.rb
raindrops-0.20.1 test/test_raindrops_gc.rb
raindrops-0.20.0 test/test_raindrops_gc.rb
raindrops-0.19.2 test/test_raindrops_gc.rb
raindrops-0.19.1 test/test_raindrops_gc.rb
raindrops-0.19.0 test/test_raindrops_gc.rb
raindrops-0.18.0 test/test_raindrops_gc.rb
raindrops-0.17.0 test/test_raindrops_gc.rb
ish_lib_manager-0.0.1 test/dummy/vendor/bundle/ruby/2.3.0/gems/raindrops-0.16.0/test/test_raindrops_gc.rb
raindrops-0.16.0 test/test_raindrops_gc.rb
raindrops-0.15.0 test/test_raindrops_gc.rb
raindrops-0.14.0.1.g8177 test/test_raindrops_gc.rb
raindrops-0.14.0 test/test_raindrops_gc.rb
raindrops-0.13.0 test/test_raindrops_gc.rb
raindrops-0.12.0.5.g821b test/test_raindrops_gc.rb
raindrops-0.12.0 test/test_raindrops_gc.rb
raindrops-0.11.0 test/test_raindrops_gc.rb
raindrops-0.10.0 test/test_raindrops_gc.rb
raindrops-0.9.0 test/test_raindrops_gc.rb
raindrops-0.8.1 test/test_raindrops_gc.rb