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



40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/minitest/unit.rb', line 40

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