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

Removed assertionRun() and rolled its logic into assertionPassed() and assertionEnded()

Commit
57c346a46d0060c2cfb1504ed7c765745301503f
Author
Phil Nash ·
Parents
67f734c79950

Files · Download .tar.gz

Changes

 include/internal/catch_interfaces_capture.h | 11 +++++------
 include/internal/catch_run_context.cpp      | 12 ++----------
 include/internal/catch_run_context.h        |  4 +---
 3 files changed, 8 insertions(+), 19 deletions(-)

diff --git a/include/internal/catch_interfaces_capture.h b/include/internal/catch_interfaces_capture.h
index 7efa510a..7234eb4e 100644
--- a/include/internal/catch_interfaces_capture.h
+++ b/include/internal/catch_interfaces_capture.h
@@ -38,16 +38,15 @@ namespace Catch {
         virtual void pushScopedMessage( MessageInfo const& message ) = 0;
         virtual void popScopedMessage( MessageInfo const& message ) = 0;
 
-        virtual std::string getCurrentTestName() const = 0;
-        virtual const AssertionResult* getLastResult() const = 0;
-
-        virtual void exceptionEarlyReported() = 0;
-
         virtual void handleFatalErrorCondition( StringRef message ) = 0;
 
         virtual bool lastAssertionPassed() = 0;
         virtual void assertionPassed() = 0;
-        virtual void assertionRun() = 0;
+
+        // Deprecated, do not use:
+        virtual std::string getCurrentTestName() const = 0;
+        virtual const AssertionResult* getLastResult() const = 0;
+        virtual void exceptionEarlyReported() = 0;
     };
 
     IResultCapture& getResultCapture();
diff --git a/include/internal/catch_run_context.cpp b/include/internal/catch_run_context.cpp
index 7a84940c..0e9cf983 100644
--- a/include/internal/catch_run_context.cpp
+++ b/include/internal/catch_run_context.cpp
@@ -111,6 +111,7 @@ namespace Catch {
     }
 
     void RunContext::assertionEnded(AssertionResult const & result) {
+        m_prevPassed = m_totals.assertions.passed;
         if (result.getResultType() == ResultWas::Ok) {
             m_totals.assertions.passed++;
         } else if (!result.isOk()) {
@@ -254,14 +255,11 @@ namespace Catch {
     }
 
     void RunContext::assertionPassed() {
+        m_prevPassed = m_totals.assertions.passed;
         ++m_totals.assertions.passed;
         resetAssertionInfo();
     }
 
-    void RunContext::assertionRun() {
-        m_prevPassed = m_totals.assertions.passed;
-    }
-
     bool RunContext::aborting() const {
         return m_totals.assertions.failed == static_cast<std::size_t>(m_config->abortAfter());
     }
@@ -332,14 +330,12 @@ namespace Catch {
         AssertionReaction& reaction
     ) {
         m_reporter->assertionStarting( info );
-        assertionRun();
 
         bool negated = isFalseTest( info.resultDisposition );
         bool result = expr.getResult() != negated;
 
         if( result ) {
             if (!m_includeSuccessfulResults) {
-                assertionRun();
                 assertionPassed();
             }
             else {
@@ -375,7 +371,6 @@ namespace Catch {
         m_reporter->assertionStarting( info );
 
         m_lastAssertionInfo = info;
-        assertionRun();
 
         AssertionResultData data( resultType, LazyExpression( false ) );
         data.message = message;
@@ -397,7 +392,6 @@ namespace Catch {
             AssertionReaction& reaction
     ) {
         m_lastAssertionInfo = info;
-        assertionRun();
 
         AssertionResultData data( ResultWas::ThrewException, LazyExpression( false ) );
         data.message = message;
@@ -415,7 +409,6 @@ namespace Catch {
             AssertionInfo const& info
     ) {
         m_lastAssertionInfo = info;
-        assertionRun();
 
         AssertionResultData data( ResultWas::ThrewException, LazyExpression( false ) );
         data.message = "Exception translation was disabled by CATCH_CONFIG_FAST_COMPILE";
@@ -428,7 +421,6 @@ namespace Catch {
             AssertionReaction &reaction
     ) {
         m_lastAssertionInfo = info;
-        assertionRun();
 
         AssertionResultData data( resultType, LazyExpression( false ) );
         AssertionResult assertionResult{ info, data };
diff --git a/include/internal/catch_run_context.h b/include/internal/catch_run_context.h
index 5b5bc253..617baba1 100644
--- a/include/internal/catch_run_context.h
+++ b/include/internal/catch_run_context.h
@@ -133,9 +133,7 @@ namespace Catch {
 
         bool lastAssertionPassed() override;
 
-        void assertionPassed() override; // devirt
-
-        void assertionRun() override; // devirt
+        void assertionPassed() override;
 
     public:
         // !TBD We need to do this another way!