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

assertionEnded event in reporters no longer returns bool

Commit
f314fa1f8c9576f1879fb0a8a9b038f1108599c2
Author
Martin Hořeňovský ·
Parents
013edc208bb7

Files · Download .tar.gz

Changes

 examples/210-Evt-EventListeners.cpp                     | 3 +--
 src/catch2/interfaces/catch_interfaces_reporter.hpp     | 3 +--
 src/catch2/internal/catch_run_context.cpp               | 4 +---
 src/catch2/reporters/catch_reporter_automake.hpp        | 5 -----
 src/catch2/reporters/catch_reporter_combined_tu.cpp     | 4 +---
 src/catch2/reporters/catch_reporter_compact.cpp         | 7 ++-----
 src/catch2/reporters/catch_reporter_compact.hpp         | 4 +---
 src/catch2/reporters/catch_reporter_console.cpp         | 5 ++---
 src/catch2/reporters/catch_reporter_console.hpp         | 2 +-
 src/catch2/reporters/catch_reporter_cumulative_base.cpp | 3 +--
 src/catch2/reporters/catch_reporter_cumulative_base.hpp | 2 +-
 src/catch2/reporters/catch_reporter_event_listener.hpp  | 2 +-
 src/catch2/reporters/catch_reporter_junit.cpp           | 4 ++--
 src/catch2/reporters/catch_reporter_junit.hpp           | 2 +-
 src/catch2/reporters/catch_reporter_listening.cpp       | 6 +++---
 src/catch2/reporters/catch_reporter_listening.hpp       | 3 +--
 src/catch2/reporters/catch_reporter_streaming_base.hpp  | 2 +-
 src/catch2/reporters/catch_reporter_tap.cpp             | 3 +--
 src/catch2/reporters/catch_reporter_tap.hpp             | 4 +---
 src/catch2/reporters/catch_reporter_teamcity.cpp        | 3 +--
 src/catch2/reporters/catch_reporter_teamcity.hpp        | 4 +---
 src/catch2/reporters/catch_reporter_xml.cpp             | 6 ++----
 src/catch2/reporters/catch_reporter_xml.hpp             | 2 +-
 23 files changed, 28 insertions(+), 55 deletions(-)

diff --git a/examples/210-Evt-EventListeners.cpp b/examples/210-Evt-EventListeners.cpp
index 7a025375..a4b938c9 100644
--- a/examples/210-Evt-EventListeners.cpp
+++ b/examples/210-Evt-EventListeners.cpp
@@ -366,10 +366,9 @@ struct MyListener : Catch::EventListenerBase {
         print( std::cout, 1, "- assertionInfo", assertionInfo );
     }
 
-    bool assertionEnded( Catch::AssertionStats const& assertionStats ) override {
+    void assertionEnded( Catch::AssertionStats const& assertionStats ) override {
         std::cout << "\nEvent: assertionEnded:\n";
         print( std::cout, 1, "- assertionStats", assertionStats );
-        return true;
     }
 };
 
diff --git a/src/catch2/interfaces/catch_interfaces_reporter.hpp b/src/catch2/interfaces/catch_interfaces_reporter.hpp
index 25ad540f..75eadee7 100644
--- a/src/catch2/interfaces/catch_interfaces_reporter.hpp
+++ b/src/catch2/interfaces/catch_interfaces_reporter.hpp
@@ -189,8 +189,7 @@ namespace Catch {
 
         virtual void assertionStarting( AssertionInfo const& assertionInfo ) = 0;
 
-        // The return value indicates if the messages buffer should be cleared:
-        virtual bool assertionEnded( AssertionStats const& assertionStats ) = 0;
+        virtual void assertionEnded( AssertionStats const& assertionStats ) = 0;
 
         virtual void sectionEnded( SectionStats const& sectionStats ) = 0;
         //! Called _every time_ a TEST_CASE is entered, including repeats (due to sections)
diff --git a/src/catch2/internal/catch_run_context.cpp b/src/catch2/internal/catch_run_context.cpp
index 1e4cc6b1..b8e74e5f 100644
--- a/src/catch2/internal/catch_run_context.cpp
+++ b/src/catch2/internal/catch_run_context.cpp
@@ -249,9 +249,7 @@ namespace Catch {
             m_lastAssertionPassed = true;
         }
 
-        // 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<void>(m_reporter->assertionEnded(AssertionStats(result, m_messages, m_totals)));
+        m_reporter->assertionEnded(AssertionStats(result, m_messages, m_totals));
 
         if (result.getResultType() != ResultWas::Warning)
             m_messageScopes.clear();
diff --git a/src/catch2/reporters/catch_reporter_automake.hpp b/src/catch2/reporters/catch_reporter_automake.hpp
index 209729c1..6e376e90 100644
--- a/src/catch2/reporters/catch_reporter_automake.hpp
+++ b/src/catch2/reporters/catch_reporter_automake.hpp
@@ -24,12 +24,7 @@ namespace Catch {
             return "Reports test results in the format of Automake .trs files"s;
         }
 
-        void assertionStarting( AssertionInfo const& ) override {}
-
-        bool assertionEnded( AssertionStats const& /*_assertionStats*/ ) override { return true; }
-
         void testCaseEnded(TestCaseStats const& _testCaseStats) override;
-
         void skipTest(TestCaseInfo const& testInfo) override;
 
     };
diff --git a/src/catch2/reporters/catch_reporter_combined_tu.cpp b/src/catch2/reporters/catch_reporter_combined_tu.cpp
index e5dc7e28..bca6ac25 100644
--- a/src/catch2/reporters/catch_reporter_combined_tu.cpp
+++ b/src/catch2/reporters/catch_reporter_combined_tu.cpp
@@ -222,9 +222,7 @@ namespace Catch {
 namespace Catch {
     void EventListenerBase::assertionStarting( AssertionInfo const& ) {}
 
-    bool EventListenerBase::assertionEnded( AssertionStats const& ) {
-        return false;
-    }
+    void EventListenerBase::assertionEnded( AssertionStats const& ) {}
     void EventListenerBase::listReporters(
         std::vector<ReporterDescription> const& ) {}
     void EventListenerBase::listTests( std::vector<TestCaseHandle> const& ) {}
diff --git a/src/catch2/reporters/catch_reporter_compact.cpp b/src/catch2/reporters/catch_reporter_compact.cpp
index 75ec7926..1bd997bd 100644
--- a/src/catch2/reporters/catch_reporter_compact.cpp
+++ b/src/catch2/reporters/catch_reporter_compact.cpp
@@ -262,9 +262,7 @@ private:
             stream << "No test cases matched '" << unmatchedSpec << "'\n";
         }
 
-        void CompactReporter::assertionStarting( AssertionInfo const& ) {}
-
-        bool CompactReporter::assertionEnded( AssertionStats const& _assertionStats ) {
+        void CompactReporter::assertionEnded( AssertionStats const& _assertionStats ) {
             AssertionResult const& result = _assertionStats.assertionResult;
 
             bool printInfoMessages = true;
@@ -272,7 +270,7 @@ private:
             // 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;
+                    return;
                 printInfoMessages = false;
             }
 
@@ -280,7 +278,6 @@ private:
             printer.print();
 
             stream << '\n' << std::flush;
-            return true;
         }
 
         void CompactReporter::sectionEnded(SectionStats const& _sectionStats) {
diff --git a/src/catch2/reporters/catch_reporter_compact.hpp b/src/catch2/reporters/catch_reporter_compact.hpp
index d7d0a733..0c632f76 100644
--- a/src/catch2/reporters/catch_reporter_compact.hpp
+++ b/src/catch2/reporters/catch_reporter_compact.hpp
@@ -24,9 +24,7 @@ namespace Catch {
 
         void noMatchingTestCases( StringRef unmatchedSpec ) override;
 
-        void assertionStarting(AssertionInfo const&) override;
-
-        bool assertionEnded(AssertionStats const& _assertionStats) override;
+        void assertionEnded(AssertionStats const& _assertionStats) override;
 
         void sectionEnded(SectionStats const& _sectionStats) override;
 
diff --git a/src/catch2/reporters/catch_reporter_console.cpp b/src/catch2/reporters/catch_reporter_console.cpp
index ab9b6086..d7c2dd59 100644
--- a/src/catch2/reporters/catch_reporter_console.cpp
+++ b/src/catch2/reporters/catch_reporter_console.cpp
@@ -391,21 +391,20 @@ void ConsoleReporter::reportInvalidArguments( StringRef arg ) {
 
 void ConsoleReporter::assertionStarting(AssertionInfo const&) {}
 
-bool ConsoleReporter::assertionEnded(AssertionStats const& _assertionStats) {
+void ConsoleReporter::assertionEnded(AssertionStats const& _assertionStats) {
     AssertionResult const& result = _assertionStats.assertionResult;
 
     bool includeResults = m_config->includeSuccessfulResults() || !result.isOk();
 
     // Drop out if result was successful but we're not printing them.
     if (!includeResults && result.getResultType() != ResultWas::Warning)
-        return false;
+        return;
 
     lazyPrint();
 
     ConsoleAssertionPrinter printer(stream, _assertionStats, includeResults);
     printer.print();
     stream << '\n' << std::flush;
-    return true;
 }
 
 void ConsoleReporter::sectionStarting(SectionInfo const& _sectionInfo) {
diff --git a/src/catch2/reporters/catch_reporter_console.hpp b/src/catch2/reporters/catch_reporter_console.hpp
index ba2db495..5a1765b3 100644
--- a/src/catch2/reporters/catch_reporter_console.hpp
+++ b/src/catch2/reporters/catch_reporter_console.hpp
@@ -28,7 +28,7 @@ namespace Catch {
 
         void assertionStarting(AssertionInfo const&) override;
 
-        bool assertionEnded(AssertionStats const& _assertionStats) override;
+        void assertionEnded(AssertionStats const& _assertionStats) override;
 
         void sectionStarting(SectionInfo const& _sectionInfo) override;
         void sectionEnded(SectionStats const& _sectionStats) override;
diff --git a/src/catch2/reporters/catch_reporter_cumulative_base.cpp b/src/catch2/reporters/catch_reporter_cumulative_base.cpp
index dd76d1eb..64afac18 100644
--- a/src/catch2/reporters/catch_reporter_cumulative_base.cpp
+++ b/src/catch2/reporters/catch_reporter_cumulative_base.cpp
@@ -64,7 +64,7 @@ namespace Catch {
         m_sectionStack.push_back( node );
     }
 
-    bool CumulativeReporterBase::assertionEnded(
+    void CumulativeReporterBase::assertionEnded(
         AssertionStats const& assertionStats ) {
         assert( !m_sectionStack.empty() );
         // AssertionResult holds a pointer to a temporary DecomposedExpression,
@@ -76,7 +76,6 @@ namespace Catch {
             assertionStats.assertionResult.getExpandedExpression() );
         SectionNode& sectionNode = *m_sectionStack.back();
         sectionNode.assertions.push_back( assertionStats );
-        return true;
     }
 
     void CumulativeReporterBase::sectionEnded( SectionStats const& sectionStats ) {
diff --git a/src/catch2/reporters/catch_reporter_cumulative_base.hpp b/src/catch2/reporters/catch_reporter_cumulative_base.hpp
index 3bbd1967..a1896e4f 100644
--- a/src/catch2/reporters/catch_reporter_cumulative_base.hpp
+++ b/src/catch2/reporters/catch_reporter_cumulative_base.hpp
@@ -62,7 +62,7 @@ namespace Catch {
 
         void assertionStarting( AssertionInfo const& ) override {}
 
-        bool assertionEnded( AssertionStats const& assertionStats ) override;
+        void assertionEnded( AssertionStats const& assertionStats ) override;
         void sectionEnded( SectionStats const& sectionStats ) override;
         void testCasePartialEnded( TestCaseStats const&, uint64_t ) override {}
         void testCaseEnded( TestCaseStats const& testCaseStats ) override;
diff --git a/src/catch2/reporters/catch_reporter_event_listener.hpp b/src/catch2/reporters/catch_reporter_event_listener.hpp
index 38d94126..333f1dfa 100644
--- a/src/catch2/reporters/catch_reporter_event_listener.hpp
+++ b/src/catch2/reporters/catch_reporter_event_listener.hpp
@@ -27,7 +27,7 @@ namespace Catch {
         void reportInvalidArguments( StringRef unmatchedSpec ) override;
 
         void assertionStarting( AssertionInfo const& assertionInfo ) override;
-        bool assertionEnded( AssertionStats const& assertionStats ) override;
+        void assertionEnded( AssertionStats const& assertionStats ) override;
 
         void listReporters(
             std::vector<ReporterDescription> const& descriptions ) override;
diff --git a/src/catch2/reporters/catch_reporter_junit.cpp b/src/catch2/reporters/catch_reporter_junit.cpp
index 4b902750..f7420b7a 100644
--- a/src/catch2/reporters/catch_reporter_junit.cpp
+++ b/src/catch2/reporters/catch_reporter_junit.cpp
@@ -81,10 +81,10 @@ namespace Catch {
         m_okToFail = testCaseInfo.okToFail();
     }
 
-    bool JunitReporter::assertionEnded( AssertionStats const& assertionStats ) {
+    void JunitReporter::assertionEnded( AssertionStats const& assertionStats ) {
         if( assertionStats.assertionResult.getResultType() == ResultWas::ThrewException && !m_okToFail )
             unexpectedExceptions++;
-        return CumulativeReporterBase::assertionEnded( assertionStats );
+        CumulativeReporterBase::assertionEnded( assertionStats );
     }
 
     void JunitReporter::testCaseEnded( TestCaseStats const& testCaseStats ) {
diff --git a/src/catch2/reporters/catch_reporter_junit.hpp b/src/catch2/reporters/catch_reporter_junit.hpp
index ea573d9b..3d68b7f6 100644
--- a/src/catch2/reporters/catch_reporter_junit.hpp
+++ b/src/catch2/reporters/catch_reporter_junit.hpp
@@ -26,7 +26,7 @@ namespace Catch {
         void testRunStarting(TestRunInfo const& runInfo) override;
 
         void testCaseStarting(TestCaseInfo const& testCaseInfo) override;
-        bool assertionEnded(AssertionStats const& assertionStats) override;
+        void assertionEnded(AssertionStats const& assertionStats) override;
 
         void testCaseEnded(TestCaseStats const& testCaseStats) override;
 
diff --git a/src/catch2/reporters/catch_reporter_listening.cpp b/src/catch2/reporters/catch_reporter_listening.cpp
index 82bc2086..a397997f 100644
--- a/src/catch2/reporters/catch_reporter_listening.cpp
+++ b/src/catch2/reporters/catch_reporter_listening.cpp
@@ -100,11 +100,11 @@ namespace Catch {
     }
 
     // The return value indicates if the messages buffer should be cleared:
-    bool ListeningReporter::assertionEnded( AssertionStats const& assertionStats ) {
+    void ListeningReporter::assertionEnded( AssertionStats const& assertionStats ) {
         for( auto& listener : m_listeners ) {
-            static_cast<void>( listener->assertionEnded( assertionStats ) );
+            listener->assertionEnded( assertionStats );
         }
-        return m_reporter->assertionEnded( assertionStats );
+        m_reporter->assertionEnded( assertionStats );
     }
 
     void ListeningReporter::sectionEnded( SectionStats const& sectionStats ) {
diff --git a/src/catch2/reporters/catch_reporter_listening.hpp b/src/catch2/reporters/catch_reporter_listening.hpp
index 87cb01f4..3813c085 100644
--- a/src/catch2/reporters/catch_reporter_listening.hpp
+++ b/src/catch2/reporters/catch_reporter_listening.hpp
@@ -45,8 +45,7 @@ namespace Catch {
         void sectionStarting( SectionInfo const& sectionInfo ) override;
         void assertionStarting( AssertionInfo const& assertionInfo ) override;
 
-        // The return value indicates if the messages buffer should be cleared:
-        bool assertionEnded( AssertionStats const& assertionStats ) override;
+        void assertionEnded( AssertionStats const& assertionStats ) override;
         void sectionEnded( SectionStats const& sectionStats ) override;
         void testCasePartialEnded(TestCaseStats const& testInfo, uint64_t partNumber) override;
         void testCaseEnded( TestCaseStats const& testCaseStats ) override;
diff --git a/src/catch2/reporters/catch_reporter_streaming_base.hpp b/src/catch2/reporters/catch_reporter_streaming_base.hpp
index e1aa0798..0cd8a46f 100644
--- a/src/catch2/reporters/catch_reporter_streaming_base.hpp
+++ b/src/catch2/reporters/catch_reporter_streaming_base.hpp
@@ -56,7 +56,7 @@ namespace Catch {
         }
 
         void assertionStarting( AssertionInfo const& ) override {}
-        bool assertionEnded( AssertionStats const& ) override { return true; }
+        void assertionEnded( AssertionStats const& ) override {}
 
         void sectionEnded(SectionStats const& /* _sectionStats */) override {
             m_sectionStack.pop_back();
diff --git a/src/catch2/reporters/catch_reporter_tap.cpp b/src/catch2/reporters/catch_reporter_tap.cpp
index 4ab2394d..46a0994d 100644
--- a/src/catch2/reporters/catch_reporter_tap.cpp
+++ b/src/catch2/reporters/catch_reporter_tap.cpp
@@ -198,7 +198,7 @@ namespace Catch {
         stream << "# No test cases matched '" << unmatchedSpec << "'\n";
     }
 
-    bool TAPReporter::assertionEnded(AssertionStats const& _assertionStats) {
+    void TAPReporter::assertionEnded(AssertionStats const& _assertionStats) {
         ++counter;
 
         stream << "# " << currentTestCaseInfo->name << '\n';
@@ -206,7 +206,6 @@ namespace Catch {
         printer.print();
 
         stream << '\n' << std::flush;
-        return true;
     }
 
     void TAPReporter::testRunEnded(TestRunStats const& _testRunStats) {
diff --git a/src/catch2/reporters/catch_reporter_tap.hpp b/src/catch2/reporters/catch_reporter_tap.hpp
index 62749869..87855847 100644
--- a/src/catch2/reporters/catch_reporter_tap.hpp
+++ b/src/catch2/reporters/catch_reporter_tap.hpp
@@ -27,9 +27,7 @@ namespace Catch {
 
         void noMatchingTestCases( StringRef unmatchedSpec ) override;
 
-        void assertionStarting( AssertionInfo const& ) override {}
-
-        bool assertionEnded(AssertionStats const& _assertionStats) override;
+        void assertionEnded(AssertionStats const& _assertionStats) override;
 
         void testRunEnded(TestRunStats const& _testRunStats) override;
 
diff --git a/src/catch2/reporters/catch_reporter_teamcity.cpp b/src/catch2/reporters/catch_reporter_teamcity.cpp
index ea67f75b..1972b8c4 100644
--- a/src/catch2/reporters/catch_reporter_teamcity.cpp
+++ b/src/catch2/reporters/catch_reporter_teamcity.cpp
@@ -56,7 +56,7 @@ namespace Catch {
                << escape( runStats.runInfo.name ) << "']\n";
     }
 
-    bool TeamCityReporter::assertionEnded(AssertionStats const& assertionStats) {
+    void TeamCityReporter::assertionEnded(AssertionStats const& assertionStats) {
         AssertionResult const& result = assertionStats.assertionResult;
         if (!result.isOk()) {
 
@@ -124,7 +124,6 @@ namespace Catch {
             }
         }
         stream.flush();
-        return true;
     }
 
     void TeamCityReporter::testCaseStarting(TestCaseInfo const& testInfo) {
diff --git a/src/catch2/reporters/catch_reporter_teamcity.hpp b/src/catch2/reporters/catch_reporter_teamcity.hpp
index ec85a671..f387cafb 100644
--- a/src/catch2/reporters/catch_reporter_teamcity.hpp
+++ b/src/catch2/reporters/catch_reporter_teamcity.hpp
@@ -38,9 +38,7 @@ namespace Catch {
         void testRunEnded( TestRunStats const& testGroupStats ) override;
 
 
-        void assertionStarting(AssertionInfo const&) override {}
-
-        bool assertionEnded(AssertionStats const& assertionStats) override;
+        void assertionEnded(AssertionStats const& assertionStats) override;
 
         void sectionStarting(SectionInfo const& sectionInfo) override {
             m_headerPrintedForThisSection = false;
diff --git a/src/catch2/reporters/catch_reporter_xml.cpp b/src/catch2/reporters/catch_reporter_xml.cpp
index f72bd867..4e2a9a34 100644
--- a/src/catch2/reporters/catch_reporter_xml.cpp
+++ b/src/catch2/reporters/catch_reporter_xml.cpp
@@ -86,7 +86,7 @@ namespace Catch {
 
     void XmlReporter::assertionStarting( AssertionInfo const& ) { }
 
-    bool XmlReporter::assertionEnded( AssertionStats const& assertionStats ) {
+    void XmlReporter::assertionEnded( AssertionStats const& assertionStats ) {
 
         AssertionResult const& result = assertionStats.assertionResult;
 
@@ -107,7 +107,7 @@ namespace Catch {
 
         // Drop out if result was successful but we're not printing them.
         if( !includeResults && result.getResultType() != ResultWas::Warning )
-            return true;
+            return;
 
 
         // Print the expression if there is one.
@@ -157,8 +157,6 @@ namespace Catch {
 
         if( result.hasExpression() )
             m_xml.endElement();
-
-        return true;
     }
 
     void XmlReporter::sectionEnded( SectionStats const& sectionStats ) {
diff --git a/src/catch2/reporters/catch_reporter_xml.hpp b/src/catch2/reporters/catch_reporter_xml.hpp
index ffe682ea..46dd667a 100644
--- a/src/catch2/reporters/catch_reporter_xml.hpp
+++ b/src/catch2/reporters/catch_reporter_xml.hpp
@@ -37,7 +37,7 @@ namespace Catch {
 
         void assertionStarting(AssertionInfo const&) override;
 
-        bool assertionEnded(AssertionStats const& assertionStats) override;
+        void assertionEnded(AssertionStats const& assertionStats) override;
 
         void sectionEnded(SectionStats const& sectionStats) override;