lib/assert/result.rb in assert-2.16.5 vs lib/assert/result.rb in assert-2.17.0

- old
+ new

@@ -1,6 +1,6 @@ -require 'assert/file_line' +require "assert/file_line" module Assert; end module Assert::Result class Base ; end @@ -26,11 +26,11 @@ end class Base def self.type; :unknown; end - def self.name; ''; end + def self.name; ""; end def self.for_test(test, message, bt) self.new({ :test_name => test.name, :test_file_line => test.file_line, @@ -52,30 +52,30 @@ def name @name ||= (@build_data[:name] || self.class.name.to_s) end def test_name - @test_name ||= (@build_data[:test_name] || '') + @test_name ||= (@build_data[:test_name] || "") end def test_file_line - @test_file_line ||= (@build_data[:test_file_line] || Assert::FileLine.parse('')) + @test_file_line ||= (@build_data[:test_file_line] || Assert::FileLine.parse("")) end def test_file_name; self.test_file_line.file; end def test_line_num; self.test_file_line.line.to_i; end def test_id self.test_file_line.to_s end def message - @message ||= (@build_data[:message] || '') + @message ||= (@build_data[:message] || "") end def output - @output ||= (@build_data[:output] || '') + @output ||= (@build_data[:output] || "") end def backtrace @backtrace ||= (@build_data[:backtrace] || Backtrace.new([])) end @@ -133,11 +133,11 @@ def ==(other_result) self.type == other_result.type && self.message == other_result.message end def inspect - "#<#{self.class}:#{'0x0%x' % (object_id << 1)} "\ + "#<#{self.class}:#{"0x0%x" % (object_id << 1)} "\ "@message=#{self.message.inspect} "\ "@file_line=#{self.file_line.to_s.inspect} "\ "@test_file_line=#{self.test_file_line.to_s.inspect}>" end @@ -164,32 +164,32 @@ end class Pass < Base def self.type; :pass; end - def self.name; 'Pass'; end + def self.name; "Pass"; end end class Ignore < Base def self.type; :ignore; end - def self.name; 'Ignore'; end + def self.name; "Ignore"; end end class HaltingTestResultError < RuntimeError attr_accessor :assert_with_bt end - # raised by the 'fail' context helper to break test execution + # raised by the "fail" context helper to break test execution TestFailure = Class.new(HaltingTestResultError) class Fail < Base def self.type; :fail; end - def self.name; 'Fail'; end + def self.name; "Fail"; end # fail results can be generated manually or by raising Assert::Result::TestFailure def self.for_test(test, msg_or_err, bt = nil) if msg_or_err.kind_of?(TestFailure) super(test, msg_or_err.message, msg_or_err.backtrace).tap do |result| @@ -202,17 +202,17 @@ end end end - # raised by the 'skip' context helper to break test execution + # raised by the "skip" context helper to break test execution TestSkipped = Class.new(HaltingTestResultError) class Skip < Base def self.type; :skip; end - def self.name; 'Skip'; end + def self.name; "Skip"; end # skip results are generated by raising Assert::Result::TestSkipped def self.for_test(test, msg_or_err, bt = nil) if msg_or_err.kind_of?(TestSkipped) super(test, msg_or_err.message, msg_or_err.backtrace).tap do |result| @@ -228,11 +228,11 @@ end class Error < Base def self.type; :error; end - def self.name; 'Error'; end + def self.name; "Error"; end # error results are generated by raising exceptions in tests def self.for_test(test, err) if err.kind_of?(Exception) super(test, "#{err.message} (#{err.class.name})", err.backtrace) @@ -272,12 +272,12 @@ protected # filter a line out if it's an assert lib/bin line def filter_out?(line) - # './lib' in project dir, or '/usr/local/blahblah' if installed - assert_lib_path = File.expand_path('../..', __FILE__) - assert_macros_path = File.join(assert_lib_path, 'assert/macros') + # "./lib" in project dir, or "/usr/local/blahblah" if installed + assert_lib_path = File.expand_path("../..", __FILE__) + assert_macros_path = File.join(assert_lib_path, "assert/macros") assert_bin_regex = /bin\/assert\:/ ( line.rindex(assert_lib_path, 0) && !line.rindex(assert_macros_path, 0) ) || line =~ assert_bin_regex