Progmasoft Git

catch3

Progmasoft Catch3: an independently maintained C++17 test framework with a parallel runner, property checks, snapshots and structured results.

Clonegit clone https://git.progmasoft.com/catch3

Refactored console reporter include logic to match Xml Reporter’s

Commit
f9db24a824b6b37eef4f9cde9798a04da59a63ef
Author
Phil Nash ·
Parents
9bee606dd633

Files · Download .tar.gz

Changes

 include/reporters/catch_reporter_console.hpp | 13 +++++--------
 include/reporters/catch_reporter_xml.hpp     |  2 +-
 2 files changed, 6 insertions(+), 9 deletions(-)

diff --git a/include/reporters/catch_reporter_console.hpp b/include/reporters/catch_reporter_console.hpp
index 224cbc9d..711d7fbe 100644
--- a/include/reporters/catch_reporter_console.hpp
+++ b/include/reporters/catch_reporter_console.hpp
@@ -40,18 +40,15 @@ namespace Catch {
         virtual bool assertionEnded( AssertionStats const& _assertionStats ) CATCH_OVERRIDE {
             AssertionResult const& result = _assertionStats.assertionResult;
 
-            bool printInfoMessages = true;
+            bool includeResults = m_config->includeSuccessfulResults() || !result.isOk();
 
-            // Drop out if result was successful and we're not printing those
-            if( !m_config->includeSuccessfulResults() && result.isOk() ) {
-                if( result.getResultType() != ResultWas::Warning )
-                    return false;
-                printInfoMessages = false;
-            }
+            // Drop out if result was successful but we're not printing them.
+            if( !includeResults && result.getResultType() != ResultWas::Warning )
+                return false;
 
             lazyPrint();
 
-            AssertionPrinter printer( stream, _assertionStats, printInfoMessages );
+            AssertionPrinter printer( stream, _assertionStats, includeResults );
             printer.print();
             stream << std::endl;
             return true;
diff --git a/include/reporters/catch_reporter_xml.hpp b/include/reporters/catch_reporter_xml.hpp
index 412a5184..55c19564 100644
--- a/include/reporters/catch_reporter_xml.hpp
+++ b/include/reporters/catch_reporter_xml.hpp
@@ -95,7 +95,7 @@ namespace Catch {
 
             AssertionResult const& result = assertionStats.assertionResult;
 
-            bool includeResults = m_config->includeSuccessfulResults() || result.isOk();
+            bool includeResults = m_config->includeSuccessfulResults() || !result.isOk();
 
             if( includeResults ) {
                 // Print any info messages in <Info> tags.