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:
parent
af1863734c
commit
413c98003b
1 changed files with 5 additions and 1 deletions
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue