diff options
author | ryan <ryan@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-12-15 22:23:52 +0000 |
---|---|---|
committer | ryan <ryan@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-12-15 22:23:52 +0000 |
commit | 5c9194fe1f5ebfc864b3516beb0c23be2af2f9e3 (patch) | |
tree | a656dc0c5c5fe412f21f4e6941e8f487d0ca4b0d /lib/minitest | |
parent | 01c0fea7d35bbf552cf2e172330cf1ae2a9afe94 (diff) |
Imported minitest 2.0.1 r6079.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30222 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/minitest')
-rw-r--r-- | lib/minitest/unit.rb | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/lib/minitest/unit.rb b/lib/minitest/unit.rb index af7d763965..e8013155fe 100644 --- a/lib/minitest/unit.rb +++ b/lib/minitest/unit.rb @@ -520,7 +520,7 @@ module MiniTest end class Unit - VERSION = "2.0.0" # :nodoc: + VERSION = "2.0.1" # :nodoc: attr_accessor :report, :failures, :errors, :skips # :nodoc: attr_accessor :test_count, :assertion_count # :nodoc: @@ -552,8 +552,16 @@ module MiniTest def self.autorun at_exit { next if $! # don't run if there was an exception + + # the order here is important. The at_exit handler must be + # installed before anyone else gets a chance to install their + # own, that way we can be assured that our exit will be last + # to run (at_exit stacks). + exit_code = nil + + at_exit { exit false if exit_code && exit_code != 0 } + exit_code = MiniTest::Unit.new.run ARGV - exit false if exit_code && exit_code != 0 } unless @@installed_at_exit @@installed_at_exit = true end @@ -657,9 +665,10 @@ module MiniTest inst._assertions = 0 print "#{suite}##{method} = " if @verbose - start_time = Time.now + + @start_time = Time.now result = inst.run self - time = Time.now - start_time + time = Time.now - @start_time print "%.2f s = " % time if @verbose print result @@ -802,7 +811,7 @@ module MiniTest def run runner trap "INFO" do - time = Time.now - runner.start_time + time = runner.start_time ? Time.now - runner.start_time : 0 warn "%s#%s %.2fs" % [self.class, self.__name__, time] runner.status $stderr end if SUPPORTS_INFO_SIGNAL |