diff options
author | Koichi Sasada <[email protected]> | 2020-03-01 03:02:05 +0900 |
---|---|---|
committer | Koichi Sasada <[email protected]> | 2020-03-01 03:02:05 +0900 |
commit | 413c98003bc936dd29e40aebad68b43fbe6a527f (patch) | |
tree | 5508d6f67b1e416d2fa0b5b258dd6167911ae77b /tool/lib/test | |
parent | af1863734ca6e68f5a1746f2962567c010b3fc92 (diff) |
show backtrace.
assert_nothing_raised doesn't show the backtrace if an exception
is thrown in a block. This patch shows this backtrace.
Diffstat (limited to 'tool/lib/test')
-rw-r--r-- | tool/lib/test/unit/core_assertions.rb | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/tool/lib/test/unit/core_assertions.rb b/tool/lib/test/unit/core_assertions.rb index 39964d921a..e5f741fafb 100644 --- a/tool/lib/test/unit/core_assertions.rb +++ b/tool/lib/test/unit/core_assertions.rb @@ -194,7 +194,11 @@ module Test end if ((args.empty? && !as) || 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 else raise |