Class Test::Unit::Error
In: lib/test/unit/error.rb
Parent: Object

Encapsulates an error in a test. Created by Test::Unit::TestCase when it rescues an exception thrown during the processing of a test.

Methods

Included Modules

Util::BacktraceFilter

Constants

SINGLE_CHARACTER = 'E'

Attributes

exception  [R] 
test_name  [R] 

Public Class methods

Creates a new Error with the given test_name and exception.

[Source]

    # File lib/test/unit/error.rb, line 24
24:       def initialize(test_name, exception)
25:         @test_name = test_name
26:         @exception = exception
27:       end

Public Instance methods

Returns a verbose version of the error description.

[Source]

    # File lib/test/unit/error.rb, line 45
45:       def long_display
46:         backtrace = filter_backtrace(@exception.backtrace).join("\n    ")
47:         "Error:\n#@test_name:\n#{message}\n    #{backtrace}"
48:       end

Returns the message associated with the error.

[Source]

    # File lib/test/unit/error.rb, line 35
35:       def message
36:         "#{@exception.class.name}: #{@exception.message}"
37:       end

Returns a brief version of the error description.

[Source]

    # File lib/test/unit/error.rb, line 40
40:       def short_display
41:         "#@test_name: #{message.split("\n")[0]}"
42:       end

Returns a single character representation of an error.

[Source]

    # File lib/test/unit/error.rb, line 30
30:       def single_character_display
31:         SINGLE_CHARACTER
32:       end

Overridden to return long_display.

[Source]

    # File lib/test/unit/error.rb, line 51
51:       def to_s
52:         long_display
53:       end

[Validate]