Removed fragile tests in https://github.com/ruby/ruby/pull/3349
This commit is contained in:
parent
ff397d0016
commit
347639ad8a
@ -504,30 +504,8 @@ class TestObjSpace < Test::Unit::TestCase
|
|||||||
;;;
|
;;;
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_dump_allocations
|
|
||||||
object = Object.new
|
|
||||||
assert_allocations_count(3) { ObjectSpace.dump(object) }
|
|
||||||
end
|
|
||||||
|
|
||||||
def test_anonymous_class_name
|
def test_anonymous_class_name
|
||||||
klass = Class.new
|
|
||||||
assert_allocations_count(4) { ObjectSpace.dump(klass) }
|
|
||||||
assert_allocations_count(3) { ObjectSpace.dump(klass) }
|
|
||||||
|
|
||||||
mod = Module.new
|
|
||||||
assert_allocations_count(3) { ObjectSpace.dump(mod) }
|
|
||||||
|
|
||||||
assert_not_include ObjectSpace.dump(Class.new), '"name"'
|
assert_not_include ObjectSpace.dump(Class.new), '"name"'
|
||||||
assert_not_include ObjectSpace.dump(Module.new), '"name"'
|
assert_not_include ObjectSpace.dump(Module.new), '"name"'
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
|
||||||
|
|
||||||
def assert_allocations_count(count)
|
|
||||||
ObjectSpace.dump(Object.new) # warming up
|
|
||||||
|
|
||||||
before = GC.stat(:total_allocated_objects)
|
|
||||||
yield
|
|
||||||
assert_equal count, GC.stat(:total_allocated_objects) - before
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user