module Probatio::ExtraErrorMethods
def line
def line backtrace.each do |l| ss = l.split(':') next unless ss.find { |e| e == test.path } return ss.find { |e| e.match?(/^\d+$/) }.to_i end -1 end
def loc; location.map(&:to_s).join(':'); end
def loc; location.map(&:to_s).join(':'); end
def location; [ path, line ]; end
def location; [ path, line ]; end
def path; test.path; end
def path; test.path; end
def source_lines
def source_lines @source_lines ||= Probatio::AssertionError.select_source_lines(test.path, line) end
def summary(indent='')
def summary(indent='') o = StringIO.new o << self.class.name << ': ' << self.message.inspect << "\n" i = backtrace.index { |l| l.match?(/\/lib\/probatio\.rb:/) } || -1 backtrace[0..i] .inject(o) { |o, l| o << indent << l << "\n" } o.string end
def trail
def trail msg = "#{self.class}: #{self.message.inspect}" @test.trail + "\n" + Probatio.c.red("#{' ' * (test.depth + 1)}#{loc} --> #{msg}") end