From b8194322718a1f61d3309023052c87090fa6bae3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Ho=C5=99e=C5=88ovsk=C3=BD?= Date: Sat, 29 Apr 2017 17:50:03 +0200 Subject: [PATCH] Don't clear out all messages upon printing an assertion. Previously, this would not print out any messages for the last CHECK ```cpp TEST_CASE("Foo") { INFO("Test case start"); for (int i = 0; i < 2; ++i) { INFO("The number is " << i); CHECK(i == 0); } CHECK(false); } ``` now it does. --- include/internal/catch_run_context.hpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/include/internal/catch_run_context.hpp b/include/internal/catch_run_context.hpp index e6dbd38c..f9d3607a 100644 --- a/include/internal/catch_run_context.hpp +++ b/include/internal/catch_run_context.hpp @@ -145,8 +145,9 @@ namespace Catch { m_totals.assertions.failed++; } - if( m_reporter->assertionEnded( AssertionStats( result, m_messages, m_totals ) ) ) - m_messages.clear(); + // We have no use for the return value (whether messages should be cleared), because messages were made scoped + // and should be let to clear themselves out. + static_cast(m_reporter->assertionEnded(AssertionStats(result, m_messages, m_totals))); // Reset working state m_lastAssertionInfo = AssertionInfo( std::string(), m_lastAssertionInfo.lineInfo, "{Unknown expression after the reported line}" , m_lastAssertionInfo.resultDisposition );