Narrow the tracing of object allocations to during each test
This commit is contained in:
parent
13939d61b4
commit
3839a8fe79
@ -961,8 +961,11 @@ module MiniTest
|
||||
}
|
||||
|
||||
leakchecker = LeakChecker.new
|
||||
if ENV["LEAK_CHECKER_TRACE_OBJECT_ALLOCATION"]
|
||||
require "objspace"
|
||||
trace = true
|
||||
end
|
||||
|
||||
continuation = proc do
|
||||
assertions = filtered_test_methods.map { |method|
|
||||
inst = suite.new method
|
||||
inst._assertions = 0
|
||||
@ -970,7 +973,12 @@ module MiniTest
|
||||
print "#{suite}##{method} = " if @verbose
|
||||
|
||||
start_time = Time.now if @verbose
|
||||
result = inst.run self
|
||||
result =
|
||||
if trace
|
||||
ObjectSpace.trace_object_allocations {inst.run self}
|
||||
else
|
||||
inst.run self
|
||||
end
|
||||
|
||||
print "%.2f s = " % (Time.now - start_time) if @verbose
|
||||
print result
|
||||
@ -986,14 +994,6 @@ module MiniTest
|
||||
return assertions.size, assertions.inject(0) { |sum, n| sum + n }
|
||||
end
|
||||
|
||||
if ENV["LEAK_CHECKER_TRACE_OBJECT_ALLOCATION"]
|
||||
require "objspace"
|
||||
ObjectSpace.trace_object_allocations(&continuation)
|
||||
else
|
||||
continuation.call
|
||||
end
|
||||
end
|
||||
|
||||
##
|
||||
# Record the result of a single test. Makes it very easy to gather
|
||||
# information. Eg:
|
||||
|
Loading…
x
Reference in New Issue
Block a user