Encapsulates an error in a test. Created by Test::Unit::TestCase when it rescues an exception thrown during the processing of a test.
Creates a new Error with the given #test_name and exception.
# File lib/test/unit/error.rb, line 25 def initialize(test_name, exception) @test_name = test_name @exception = exception end
# File lib/test/unit/error.rb, line 65 def critical? true end
# File lib/test/unit/error.rb, line 35 def label LABEL end
# File lib/test/unit/error.rb, line 55 def location @location ||= filter_backtrace(@exception.backtrace) end
Returns a verbose version of the error description.
# File lib/test/unit/error.rb, line 50 def long_display backtrace_display = location.join("\n ") "#{label}:\n#@test_name:\n#{message}\n #{backtrace_display}" end
Returns the message associated with the error.
# File lib/test/unit/error.rb, line 40 def message "#{@exception.class.name}: #{@exception.message}" end
Returns a brief version of the error description.
# File lib/test/unit/error.rb, line 45 def short_display "#@test_name: #{message.split("\n")[0]}" end
Returns a single character representation of an error.
# File lib/test/unit/error.rb, line 31 def single_character_display SINGLE_CHARACTER end
Overridden to return long_display.
# File lib/test/unit/error.rb, line 61 def to_s long_display end