Read-only mirrors. Development, issues and pull requests are on GitHub.

summaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authordvirtz2017-03-31 01:06:35 +0300
committerMartin Hořeňovský2017-04-04 11:27:19 +0200
commit9a07dde16dc8fab02edfac3984fb204dc61b2ba4 (patch)
treecc099583426d6f6d33c394889692d2ca26379556 /include
parent6e091d399128a55887fb33f57e35bd6cbb32a162 (diff)
downloadcatch3-9a07dde16dc8fab02edfac3984fb204dc61b2ba4.tar.gz
print messages when unexpected exceptions are thrown
Diffstat (limited to 'include')
-rw-r--r--include/internal/catch_message.hpp5
-rw-r--r--include/reporters/catch_reporter_console.hpp6
2 files changed, 9 insertions, 2 deletions
diff --git a/include/internal/catch_message.hpp b/include/internal/catch_message.hpp
index 42866be8..1b72afec 100644
--- a/include/internal/catch_message.hpp
+++ b/include/internal/catch_message.hpp
@@ -38,7 +38,10 @@ namespace Catch {
{}
ScopedMessage::~ScopedMessage() {
- getResultCapture().popScopedMessage( m_info );
+ if (!std::uncaught_exception())
+ {
+ getResultCapture().popScopedMessage(m_info);
+ }
}
diff --git a/include/reporters/catch_reporter_console.hpp b/include/reporters/catch_reporter_console.hpp
index fed97072..5f181241 100644
--- a/include/reporters/catch_reporter_console.hpp
+++ b/include/reporters/catch_reporter_console.hpp
@@ -138,7 +138,11 @@ namespace Catch {
case ResultWas::ThrewException:
colour = Colour::Error;
passOrFail = "FAILED";
- messageLabel = "due to unexpected exception with message";
+ messageLabel = "due to unexpected exception with ";
+ if (_stats.infoMessages.size() == 1)
+ messageLabel += "message";
+ if (_stats.infoMessages.size() > 1)
+ messageLabel += "messages";
break;
case ResultWas::FatalErrorCondition:
colour = Colour::Error;