summaryrefslogtreecommitdiff
path: root/test/lib/minitest/unit.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/lib/minitest/unit.rb')
-rw-r--r--test/lib/minitest/unit.rb36
1 files changed, 23 insertions, 13 deletions
diff --git a/test/lib/minitest/unit.rb b/test/lib/minitest/unit.rb
index b71e8b85b0..fa79b3bcf5 100644
--- a/test/lib/minitest/unit.rb
+++ b/test/lib/minitest/unit.rb
@@ -872,35 +872,45 @@ module MiniTest
suites = TestCase.send "#{type}_suites"
return if suites.empty?
- start = Time.now
-
puts
puts "# Running #{type}s:"
puts
@test_count, @assertion_count = 0, 0
+ test_count = assertion_count = 0
sync = output.respond_to? :"sync=" # stupid emacs
old_sync, output.sync = output.sync, true if sync
- results = _run_suites suites, type
-
- @test_count = results.inject(0) { |sum, (tc, _)| sum + tc }
- @assertion_count = results.inject(0) { |sum, (_, ac)| sum + ac }
+ count = 0
+ begin
+ start = Time.now
+
+ results = _run_suites suites, type
+
+ @test_count = results.inject(0) { |sum, (tc, _)| sum + tc }
+ @assertion_count = results.inject(0) { |sum, (_, ac)| sum + ac }
+ test_count += @test_count
+ assertion_count += @assertion_count
+ t = Time.now - start
+ count += 1
+ unless @repeat_count
+ puts
+ puts
+ end
+ puts "Finished%s %ss in %.6fs, %.4f tests/s, %.4f assertions/s.\n" %
+ [(@repeat_count ? "(#{count}/#{@repeat_count}) " : ""), type,
+ t, @test_count.fdiv(t), @assertion_count.fdiv(t)]
+ end while @repeat_count && count < @repeat_count && report.empty?
output.sync = old_sync if sync
- t = Time.now - start
-
- puts
- puts
- puts "Finished #{type}s in %.6fs, %.4f tests/s, %.4f assertions/s." %
- [t, test_count / t, assertion_count / t]
-
report.each_with_index do |msg, i|
puts "\n%3d) %s" % [i + 1, msg]
end
puts
+ @test_count = test_count
+ @assertion_count = assertion_count
status
end