From 413c98003bc936dd29e40aebad68b43fbe6a527f Mon Sep 17 00:00:00 2001 From: Koichi Sasada Date: Sun, 1 Mar 2020 03:02:05 +0900 Subject: [PATCH] show backtrace. assert_nothing_raised doesn't show the backtrace if an exception is thrown in a block. This patch shows this backtrace. --- tool/lib/test/unit/core_assertions.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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