1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Use assert_separately to speed up slow tests

These speed will slow down when there are many objects like test-all.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38370 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
naruse 2012-12-14 01:38:12 +00:00
parent bc2195e4fb
commit 1e7ef5882e
2 changed files with 6 additions and 2 deletions

View file

@ -70,6 +70,7 @@ class TestObjSpace < Test::Unit::TestCase
end
def test_reachable_objects_from
assert_separately %w[--disable-gem -robjspace], __FILE__, __LINE__, <<-'eom'
assert_equal(nil, ObjectSpace.reachable_objects_from(nil))
assert_equal([Array, 'a', 'b', 'c'], ObjectSpace.reachable_objects_from(['a', 'b', 'c']))
@ -91,9 +92,11 @@ class TestObjSpace < Test::Unit::TestCase
end
}
assert_operator(max, :>=, 1_001, "1000 elems + Array class")
eom
end
def test_reachable_objects_size
assert_separately %w[--disable-gem -robjspace], __FILE__, __LINE__, <<-'eom'
ObjectSpace.each_object{|o|
ObjectSpace.reachable_objects_from(o).each{|reached_obj|
size = ObjectSpace.memsize_of(reached_obj)
@ -101,5 +104,6 @@ class TestObjSpace < Test::Unit::TestCase
assert_operator(size, :>=, 0)
}
}
eom
end
end

View file

@ -120,6 +120,7 @@ class TestGc < Test::Unit::TestCase
end
def test_profiler_clear
assert_separately %w[--disable-gem], __FILE__, __LINE__, <<-'eom'
GC::Profiler.enable
GC.start
@ -131,8 +132,7 @@ class TestGc < Test::Unit::TestCase
assert_equal(200, GC::Profiler.raw_data.size)
GC::Profiler.clear
assert_equal(0, GC::Profiler.raw_data.size)
ensure
GC::Profiler.disable
eom
end
def test_finalizing_main_thread