Skip to content
Browse files

Add printing of suite time per test

  • Loading branch information...
1 parent 6283280 commit 8059b1c053828dd1417811032b945ff2c656f925 @quirkey committed Aug 1, 2011
Showing with 10 additions and 0 deletions.
  1. +10 −0 lib/minitest/display.rb
View
10 lib/minitest/display.rb
@@ -25,6 +25,7 @@ def options
@options ||= {
suite_names: true,
suite_divider: " | ",
+ suite_time: true,
color: true,
wrap_at: 80,
print: {
@@ -164,6 +165,8 @@ def _run_suite(suite, type)
wrap_at = display.options[:wrap_at] - suite_header.length
wrap_count = wrap_at
+ full_start_time = Time.now
+
assertions = suite.send("#{type}_methods").grep(filter).map { |method|
inst = suite.new method
inst._assertions = 0
@@ -196,6 +199,13 @@ def _run_suite(suite, type)
inst._assertions
}
+ total_time = Time.now - full_start_time
+
+ if display.options[:suite_time]
+ print "\n#{' ' * suite_header.length}#{display.options[:suite_divider]}"
+ print "%.2f s" % total_time
+ puts
+ end
return assertions.size, assertions.inject(0) { |sum, n| sum + n }
end

0 comments on commit 8059b1c

Please sign in to comment.
Something went wrong with that request. Please try again.