Class: Test::Unit::Error

Class | Test::Unit::Error
In: | 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

long_display message new short_display single_character_display to_s

### Included Modules

Util::BacktraceFilter

### Constants

SINGLE_CHARACTER | = | 'E'

### Attributes

exception | [R] |
test_name | [R] |

### Public Class methods

new(test_name, exception)

Creates a new Error with the given test_name and exception.

[Source]

    # File test/unit/error.rb, line 22
          def initialize(test_name, exception)
            @test_name = test_name
            @exception = exception
          end

### Public Instance methods

long_display()

Returns a verbose version of the error description.

[Source]

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

message()

Returns the message associated with the error.

[Source]

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

short_display()

Returns a brief version of the error description.

[Source]

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

single_character_display()

Returns a single character representation of an error.

[Source]

    # File test/unit/error.rb, line 28
          def single_character_display
            SINGLE_CHARACTER
          end

to_s()

Overridden to return long_display.

[Source]

    # File test/unit/error.rb, line 49
          def to_s
            long_display
          end

[Validate]