diff options
Diffstat (limited to 'tool/lib/test/unit.rb')
-rw-r--r-- | tool/lib/test/unit.rb | 30 |
1 files changed, 13 insertions, 17 deletions
diff --git a/tool/lib/test/unit.rb b/tool/lib/test/unit.rb index 36cfc349f4..35aeed6c21 100644 --- a/tool/lib/test/unit.rb +++ b/tool/lib/test/unit.rb @@ -9,16 +9,6 @@ require "leakchecker" # See Test::Unit module Test - ## - # Assertion base class - - class Assertion < Exception; end - - ## - # Assertion raised when skipping a test - - class Skip < Assertion; end - class << self ## # Filter object for backtraces. @@ -62,9 +52,15 @@ module Test # Test::Unit has been left in the standard library to support legacy test # suites. module Unit - # Compatibility hack for assert_raise - AssertionFailedError = Test::Assertion - PendedError = Test::Skip + ## + # Assertion base class + + class AssertionFailedError < Exception; end + + ## + # Assertion raised when skipping a test + + class PendedError < AssertionFailedError; end module RunCount # :nodoc: all @@run_count = 0 @@ -630,7 +626,7 @@ module Test unless @interrupt || !@options[:retry] || @need_quit parallel = @options[:parallel] @options[:parallel] = false - suites, rep = rep.partition {|r| r[:testcase] && r[:file] && r[:report].any? {|e| !e[2].is_a?(Test::Skip)}} + suites, rep = rep.partition {|r| r[:testcase] && r[:file] && r[:report].any? {|e| !e[2].is_a?(Test::Unit::PendedError)}} suites.map {|r| File.realpath(r[:file])}.uniq.each {|file| require file} suites.map! {|r| eval("::"+r[:testcase])} del_status_line or puts @@ -1535,11 +1531,11 @@ module Test # hidden when not verbose (-v), note this is temporally. n = report.size e = case e - when Test::Skip then + when Test::Unit::PendedError then @skips += 1 return "S" unless @verbose "Skipped:\n#{klass}##{meth} [#{location e}]:\n#{e.message}\n" - when Test::Assertion then + when Test::Unit::AssertionFailedError then @failures += 1 "Failure:\n#{klass}##{meth} [#{location e}]:\n#{e.message}\n" else @@ -1549,7 +1545,7 @@ module Test end @report << e rep = e[0, 1] - if Test::Skip === e and /no message given\z/ =~ e.message + if Test::Unit::PendedError === e and /no message given\z/ =~ e.message report.slice!(n..-1) rep = "." end |