Class | Test::Unit::Failure
In: | test/unit/failure.rb
Parent: | Object

Encapsulates a test failure. Created by Test::Unit::TestCase when an assertion fails.

### Methods

long_display new short_display single_character_display to_s

### Constants

SINGLE_CHARACTER | = | 'F'

### Attributes

location | [R] |
message | [R] |
test_name | [R] |

### Public Class methods

new(test_name, location, message)

Creates a new Failure with the given location and message.

[Source]

    # File test/unit/failure.rb, line 17
          def initialize(test_name, location, message)
            @test_name = test_name
            @location = location
            @message = message
          end

### Public Instance methods

long_display()

Returns a verbose version of the error description.

[Source]

    # File test/unit/failure.rb, line 34
          def long_display
            location_display = if(location.size == 1)
              location[0].sub(/\A(.+:\d+).*/, ' [\\1]')
            else
              "\n    [#{location.join("\n     ")}]"
            end
            "Failure:\n#@test_name#{location_display}:\n#@message"
          end

short_display()

Returns a brief version of the error description.

[Source]

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

single_character_display()

Returns a single character representation of a failure.

[Source]

    # File test/unit/failure.rb, line 24
          def single_character_display
            SINGLE_CHARACTER
          end

to_s()

Overridden to return long_display.

[Source]

    # File test/unit/failure.rb, line 44
          def to_s
            long_display
          end

[Validate]