class Minitest::Result

def self.from runnable

def self.from runnable
  o = runnable
  r = self.new o.name
  r.klass      = o.class.name
  r.assertions = o.assertions
  r.failures   = o.failures.dup
  r.time       = o.time
  r.source_location = o.method(o.name).source_location rescue ["unknown", -1]
  r
end

def error?

def error?
  self.failures.any? { |f| UnexpectedError === f }
end

def location

def location
  loc = " [#{self.failure.location}]" unless passed? or error?
  "#{self.klass}##{self.name}#{loc}"
end

def passed?

def passed?
  not self.failure
end

def result_code

def result_code
  self.failure and self.failure.result_code or "."
end

def skipped?

def skipped?
  self.failure and Skip === self.failure
end

def to_s # :nodoc:

:nodoc:
def to_s # :nodoc:
  return location if passed? and not skipped?
  failures.map { |failure|
    "#{failure.result_label}:\n#{self.location}:\n#{failure.message}\n"
  }.join "\n"
end