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

Methods
L
N
S
T
Constants
SINGLE_CHARACTER = 'F'
 
Attributes
[R] location
[R] message
[R] test_name
Class Public methods
new(test_name, location, message)

Creates a new Failure with the given location and message.

# File lib/test/unit/failure.rb, line 19
def initialize(test_name, location, message)
  @test_name = test_name
  @location = location
  @message = message
end
Instance Public methods
long_display()

Returns a verbose version of the error description.

# File lib/test/unit/failure.rb, line 36
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.

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

Returns a single character representation of a failure.

# File lib/test/unit/failure.rb, line 26
def single_character_display
  SINGLE_CHARACTER
end
to_s()

Overridden to return long_display.

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