Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff -r old/lib/minitest.rb new/lib/minitest.rb
- --- old/lib/minitest.rb
- +++ new/lib/minitest.rb
- @@ -436,6 +436,41 @@
- end
- end
- + module Thingy
- + ##
- + # Did this run pass?
- + #
- + # Note: skipped runs are not considered passing, but they don't
- + # cause the process to exit non-zero.
- +
- + def passed?
- + not self.failure
- + end
- +
- + ##
- + # The location identifier of this test.
- +
- + def location
- + loc = " [#{self.failure.location}]" unless passed? or error?
- + k = self.respond_to?(:klass) ? self.klass : self.class.name
- + "#{k}##{self.name}#{loc}"
- + end
- +
- + ##
- + # Returns ".", "F", or "E" based on the result of the run.
- +
- + def result_code
- + self.failure and self.failure.result_code or "."
- + end
- +
- + ##
- + # Was this run skipped?
- +
- + def skipped?
- + self.failure and Skip === self.failure
- + end
- + end
- +
- ##
- # This represents a test result in a clean way that can be
- # marshalled over a wire. Tests can do anything they want to the
- @@ -444,6 +479,8 @@
- # that the test result can be marshalled.
- class Result < Runnable
- + include Minitest::Thingy
- +
- undef_method :marshal_dump
- undef_method :marshal_load
- @@ -481,38 +518,6 @@
- self.failures.any? { |f| UnexpectedError === f }
- end
- - ##
- - # The location identifier of this test.
- -
- - def location
- - loc = " [#{self.failure.location}]" unless passed? or error?
- - "#{self.klass || self.class.name}##{self.name}#{loc}"
- - end
- -
- - ##
- - # Did this run pass?
- - #
- - # Note: skipped runs are not considered passing, but they don't
- - # cause the process to exit non-zero.
- -
- - def passed?
- - not self.failure
- - end
- -
- - ##
- - # Returns ".", "F", or "E" based on the result of the run.
- -
- - def result_code
- - self.failure and self.failure.result_code or "."
- - end
- -
- - ##
- - # Was this run skipped?
- -
- - def skipped?
- - self.failure and Skip === self.failure
- - end
- -
- def to_s # :nodoc:
- return location if passed? and not skipped?
- diff -r old/lib/minitest/test.rb new/lib/minitest/test.rb
- --- old/lib/minitest/test.rb
- +++ new/lib/minitest/test.rb
- @@ -7,9 +7,10 @@
- #
- # See Minitest::Assertions
- - class Test < Result
- + class Test < Runnable
- require "minitest/assertions"
- include Minitest::Assertions
- + include Minitest::Thingy
- PASSTHROUGH_EXCEPTIONS = [NoMemoryError, SignalException, SystemExit] # :nodoc:
Add Comment
Please, Sign In to add comment