Class: Test::Unit::Error
Relationships & Source Files | |
Super Chains via Extension / Inclusion / Inheritance | |
Instance Chain:
self,
Util::BacktraceFilter
|
|
Inherits: | Object |
Defined in: | lib/test/unit/error.rb |
Overview
Encapsulates an error in a test. Created by TestCase when it rescues an exception thrown during the processing of a test.
Constant Summary
-
LABEL =
# File 'lib/test/unit/error.rb', line 22"Error"
-
SINGLE_CHARACTER =
# File 'lib/test/unit/error.rb', line 21'E'
Util::BacktraceFilter - Included
POWERASSERT_PREFIX, TESTUNIT_FILE_SEPARATORS, TESTUNIT_PREFIX, TESTUNIT_RB_FILE
Class Method Summary
-
.new(test_name, exception, options = {}) ⇒ Error
constructor
Creates a new
Error
with the given test_name and exception.
Instance Attribute Summary
- #critical? ⇒ Boolean readonly
- #exception readonly
- #method_name readonly
- #test_name readonly
Instance Method Summary
-
#backtrace
Alias for #location.
- #label
- #location (also: #backtrace)
-
#long_display
Returns a verbose version of the error description.
-
#message
Returns the message associated with the error.
-
#short_display
Returns a brief version of the error description.
-
#single_character_display
Returns a single character representation of an error.
-
#to_s
Overridden to return long_display.
Util::BacktraceFilter - Included
Constructor Details
.new(test_name, exception, options = {}) ⇒ Error
Creates a new Error
with the given test_name and exception.
# File 'lib/test/unit/error.rb', line 26
def initialize(test_name, exception, ={}) @test_name = test_name @exception = exception @method_name = [:method_name] end
Instance Attribute Details
#critical? ⇒ Boolean
(readonly)
[ GitHub ]
# File 'lib/test/unit/error.rb', line 67
def critical? true end
#exception (readonly)
[ GitHub ]# File 'lib/test/unit/error.rb', line 18
attr_reader :test_name, :exception
#method_name (readonly)
[ GitHub ]# File 'lib/test/unit/error.rb', line 19
attr_reader :method_name
#test_name (readonly)
[ GitHub ]# File 'lib/test/unit/error.rb', line 18
attr_reader :test_name, :exception
Instance Method Details
#backtrace
Alias for #location.
# File 'lib/test/unit/error.rb', line 60
alias_method :backtrace, :location # Deprecated
#label
[ GitHub ]# File 'lib/test/unit/error.rb', line 37
def label LABEL end
#location Also known as: #backtrace
[ GitHub ]# File 'lib/test/unit/error.rb', line 57
def location @location ||= filter_backtrace(@exception.backtrace) end
#long_display
Returns a verbose version of the error description.
#message
Returns the message associated with the error.
# File 'lib/test/unit/error.rb', line 42
def "#{@exception.class.name}: #{@exception.}" end
#short_display
Returns a brief version of the error description.
# File 'lib/test/unit/error.rb', line 47
def short_display "#@test_name: #{ .split("\n")[0]}" end
#single_character_display
Returns a single character representation of an error.
# File 'lib/test/unit/error.rb', line 33
def single_character_display SINGLE_CHARACTER end
#to_s
Overridden to return long_display.
# File 'lib/test/unit/error.rb', line 63
def to_s long_display end