123456789_123456789_123456789_123456789_123456789_

Exception: Minitest::UnexpectedError

Relationships & Source Files
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
self, Assertion, Exception
Instance Chain:
self, Compress, Assertion, Exception
Inherits: Minitest::Assertion
Defined in: lib/minitest.rb

Overview

Assertion wrapping an unexpected error that was raised during a run.

Constant Summary

Assertion - Inherited

RE

Class Method Summary

Instance Attribute Summary

  • #error rw Internal use only

    TODO: figure out how to use cause instead.

Instance Method Summary

Compress - Included

#compress

Takes a backtrace (array of strings) and compresses repeating cycles in it to make it more readable.

Assertion - Inherited

#location

Where was this run before an assertion was raised?

#error, #result_code, #result_label

Constructor Details

.new(error) ⇒ UnexpectedError

This method is for internal use only.
[ GitHub ]

  
# File 'lib/minitest.rb', line 1065

def initialize error # :nodoc:
  super "Unexpected exception"

  if SystemStackError === error then
    bt = error.backtrace
    new_bt = compress bt
    error = error.exception "#{bt.size} -> #{new_bt.size}"
    error.set_backtrace new_bt
  end

  self.error = error
end

Instance Attribute Details

#error (rw)

This method is for internal use only.

TODO: figure out how to use cause instead

[ GitHub ]

  
# File 'lib/minitest.rb', line 1063

attr_accessor :error # :nodoc:

Instance Method Details

#backtrace

This method is for internal use only.
[ GitHub ]

  
# File 'lib/minitest.rb', line 1078

def backtrace # :nodoc:
  self.error.backtrace
end

#message

This method is for internal use only.
[ GitHub ]

  
# File 'lib/minitest.rb', line 1084

def message # :nodoc:
  bt = Minitest.filter_backtrace(self.backtrace).join("\n    ")
    .gsub(BASE_RE, "")
  "#{self.error.class}: #{self.error.message}\n    #{bt}"
end

#result_label

This method is for internal use only.
[ GitHub ]

  
# File 'lib/minitest.rb', line 1090

def result_label # :nodoc:
  "Error"
end