Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

avoided calls to Time.now and Time#- unelss verbose is enabled

  • Loading branch information...
commit 7fdcc7b62ad0053a73c27c8b41ed584daba210b6 1 parent c0dc789
@tenderlove authored
Showing with 9 additions and 4 deletions.
  1. +9 −4 lib/minitest/unit.rb
View
13 lib/minitest/unit.rb
@@ -824,13 +824,18 @@ def _run_suite suite, type
inst = suite.new method
inst._assertions = 0
- print "#{suite}##{method} = " if @verbose
+ if @verbose
+ print "#{suite}##{method} = "
+ start_time = Time.now
+ end
- @start_time = Time.now
result = inst.run self
- time = Time.now - @start_time
- print "%.2f s = " % time if @verbose
+ if @verbose
+ time = Time.now - start_time
+ print "%.2f s = " % time
+ end
+
print result
puts if @verbose
Please sign in to comment.
Something went wrong with that request. Please try again.