lib/qed/reporter/abstract.rb in qed-2.6.1 vs lib/qed/reporter/abstract.rb in qed-2.6.2

- old
+ new

@@ -55,10 +55,15 @@ def trace? @trace end # + def success? + record[:error] + record[:fail] == 0 + end + + # def update(type, *args) __send__("count_#{type}", *args) if respond_to?("count_#{type}") __send__("#{type}", *args) end @@ -269,11 +274,15 @@ end end # def clean_backtrace(*btrace) - stack = btrace.reject{ |bt| bt =~ INTERNALS } unless $DEBUG + stack = if $DEBUG + btrace + else + btrace.reject{ |bt| bt =~ INTERNALS } + end stack.map do |bt| bt.chomp(":in \`__binding__'") end end @@ -304,10 +313,11 @@ radius = radius.to_i file, lineno = file_and_line(exception) return nil if file.empty? + return nil if file == '(eval)' source = source(file) region = [lineno - radius, 1].max .. [lineno + radius, source.length].min @@ -354,10 +364,14 @@ # @param file [String] full pathname to file # # @return [String] source code def source(file) @source[file] ||= ( - File.readlines(file) + if File.exist?(file) + File.readlines(file) + else + '' + end ) end # @param exception [Exception,Array,String] # An exception or backtrace.