Exception: Minitest::UnexpectedError
- Includes:
- Compress
- Defined in:
- lib/minitest.rb
Overview
Assertion wrapping an unexpected error that was raised during a run.
Constant Summary collapse
- BASE_RE =
:nodoc:
%r%#{Regexp.escape Dir.pwd}/%
Constants inherited from Assertion
Instance Attribute Summary collapse
-
#error ⇒ Object
TODO: figure out how to use
causeinstead.
Instance Method Summary collapse
-
#backtrace ⇒ Object
:nodoc:.
-
#initialize(error) ⇒ UnexpectedError
constructor
:nodoc:.
-
#message ⇒ Object
:nodoc:.
-
#result_label ⇒ Object
:nodoc:.
Methods included from Compress
Methods inherited from Assertion
Constructor Details
#initialize(error) ⇒ UnexpectedError
:nodoc:
1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 |
# File 'lib/minitest.rb', line 1083 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 ⇒ Object
TODO: figure out how to use cause instead
1081 1082 1083 |
# File 'lib/minitest.rb', line 1081 def error @error end |
Instance Method Details
#backtrace ⇒ Object
:nodoc:
1096 1097 1098 |
# File 'lib/minitest.rb', line 1096 def backtrace # :nodoc: self.error.backtrace end |
#message ⇒ Object
:nodoc:
1102 1103 1104 1105 1106 |
# File 'lib/minitest.rb', line 1102 def # :nodoc: bt = Minitest.filter_backtrace(self.backtrace).join("\n ") .gsub(BASE_RE, "") "#{self.error.class}: #{self.error.}\n #{bt}" end |
#result_label ⇒ Object
:nodoc:
1108 1109 1110 |
# File 'lib/minitest.rb', line 1108 def result_label # :nodoc: "Error" end |