1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Exclude also core_assertions.rb from backtraces

This commit is contained in:
Nobuyoshi Nakada 2021-10-09 16:17:37 +09:00
parent 3932227d96
commit fc913ad21d
No known key found for this signature in database
GPG key ID: 7CD2805BFA3770C6

View file

@ -21,14 +21,15 @@ module Test
return ["No backtrace"] unless bt
new_bt = []
pattern = %r[/(?:lib\/test/|core_assertions\.rb:)]
unless $DEBUG then
bt.each do |line|
break if line =~ /lib\/test/
break if pattern.match?(line)
new_bt << line
end
new_bt = bt.reject { |line| line =~ /lib\/test/ } if new_bt.empty?
new_bt = bt.reject { |line| pattern.match?(line) } if new_bt.empty?
new_bt = bt.dup if new_bt.empty?
else
new_bt = bt.dup