Encapsulates a test failure. Created by Test::Unit::TestCase when an assertion fails.
Creates a new Failure with the given location and message.
# File lib/test/unit/failure.rb, line 22 def initialize(test_name, location, message, options={}) @test_name = test_name @location = location @message = message @expected = options[:expected] @actual = options[:actual] @inspected_expected = options[:inspected_expected] @inspected_actual = options[:inspected_actual] @user_message = options[:user_message] end
# File lib/test/unit/failure.rb, line 66 def diff @diff ||= compute_diff end
Returns a verbose version of the error description.
# File lib/test/unit/failure.rb, line 48 def long_display if location.size == 1 location_display = location[0].sub(/\A(.+:\d+).*/, ' [\1]') else location_display = "\n [#{location.join("\n ")}]" end "#{label}:\n#@test_name#{location_display}:\n#@message" end
Returns a brief version of the error description.
# File lib/test/unit/failure.rb, line 43 def short_display "#@test_name: #{@message.split("\n")[0]}" end
Generated with the Darkfish Rdoc Generator 2.