Class: MiniTest::BacktraceFilter

Inherits:
Object
  • Object
show all
Defined in:
lib/minitest/unit.rb

Overview

:nodoc:

Instance Method Summary collapse

Instance Method Details

#filter(bt) ⇒ Object


48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/minitest/unit.rb', line 48

def filter bt
  return ["No backtrace"] unless bt

  new_bt = []

  unless $DEBUG then
    bt.each do |line|
      break if line =~ /lib\/minitest/
      new_bt << line
    end

    new_bt = bt.reject { |line| line =~ /lib\/minitest/ } if new_bt.empty?
    new_bt = bt.dup if new_bt.empty?
  else
    new_bt = bt.dup
  end

  new_bt
end