| Class | Test::Unit::Failure |
| In: |
lib/test/unit/failure.rb
|
| Parent: | Object |
Encapsulates a test failure. Created by Test::Unit::TestCase when an assertion fails.
| SINGLE_CHARACTER | = | 'F' |
| location | [R] | |
| message | [R] | |
| test_name | [R] |
Returns a verbose version of the error description.
# File lib/test/unit/failure.rb, line 36
36: def long_display
37: location_display = if(location.size == 1)
38: location[0].sub(/\A(.+:\d+).*/, ' [\\1]')
39: else
40: "\n [#{location.join("\n ")}]"
41: end
42: "Failure:\n#@test_name#{location_display}:\n#@message"
43: end
Returns a brief version of the error description.
# File lib/test/unit/failure.rb, line 31
31: def short_display
32: "#@test_name: #{@message.split("\n")[0]}"
33: end
Returns a single character representation of a failure.
# File lib/test/unit/failure.rb, line 26
26: def single_character_display
27: SINGLE_CHARACTER
28: end
Overridden to return long_display.
# File lib/test/unit/failure.rb, line 46
46: def to_s
47: long_display
48: end