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

show backtrace.

assert_nothing_raised doesn't show the backtrace if an exception
is thrown in a block. This patch shows this backtrace.
This commit is contained in:
Koichi Sasada 2020-03-01 03:02:05 +09:00
parent af1863734c
commit 413c98003b

View file

@ -194,7 +194,11 @@ module Test
end end
if ((args.empty? && !as) || if ((args.empty? && !as) ||
args.any? {|a| a.instance_of?(Module) ? e.is_a?(a) : e.class == a }) args.any? {|a| a.instance_of?(Module) ? e.is_a?(a) : e.class == a })
msg = message(msg) { "Exception raised:\n<#{mu_pp(e)}>" } msg = message(msg) {
"Exception raised:\n<#{mu_pp(e)}>\n" +
"Backtrace:\n" +
e.backtrace.map{|frame| " #{frame}"}.join("\n")
}
raise MiniTest::Assertion, msg.call, bt raise MiniTest::Assertion, msg.call, bt
else else
raise raise