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 IRunner (rolled into IRunContext)

Commit
eea9357284f64577a131d837bdc1d8b08a6f5c0d
Author
Phil Nash ·
Parents
73968f29a520

Files · Download .tar.gz

Changes

 include/catch.hpp                                    |  1 -
 include/catch_session.hpp                            |  2 +-
 include/internal/catch_capture.hpp                   |  1 -
 include/internal/catch_context.h                     |  3 ---
 include/internal/catch_context_impl.hpp              |  9 +--------
 include/internal/catch_impl.hpp                      |  1 -
 include/internal/catch_interfaces_capture.h          |  5 +++--
 include/internal/catch_interfaces_runner.h           | 20 --------------------
 include/internal/catch_result_builder.hpp            |  3 +--
 include/internal/catch_run_context.hpp               | 14 ++++++--------
 .../SurrogateCpps/catch_interfaces_runner.cpp        |  1 -
 .../CatchSelfTest.xcodeproj/project.pbxproj          |  6 ------
 12 files changed, 12 insertions(+), 54 deletions(-)

diff --git a/include/catch.hpp b/include/catch.hpp
index 2bb35277..ebf0d722 100644
--- a/include/catch.hpp
+++ b/include/catch.hpp
@@ -42,7 +42,6 @@
 // These files are included here so the single_include script doesn't put them
 // in the conditionally compiled sections
 #include "internal/catch_test_case_info.h"
-#include "internal/catch_interfaces_runner.h"
 
 #ifdef __OBJC__
 #include "internal/catch_objc.hpp"
diff --git a/include/catch_session.hpp b/include/catch_session.hpp
index 9cfc28fd..8627cc2b 100644
--- a/include/catch_session.hpp
+++ b/include/catch_session.hpp
@@ -74,7 +74,7 @@ namespace Catch {
         for( std::vector<TestCase>::const_iterator it = allTestCases.begin(), itEnd = allTestCases.end();
                 it != itEnd;
                 ++it ) {
-            if( !context.aborting() && matchTest( *it, testSpec, *iconfig ) )
+            if( !context.isAborting() && matchTest( *it, testSpec, *iconfig ) )
                 totals += context.runTest( *it );
             else
                 reporter->skipTest( *it );
diff --git a/include/internal/catch_capture.hpp b/include/internal/catch_capture.hpp
index fe634452..3d23206e 100644
--- a/include/internal/catch_capture.hpp
+++ b/include/internal/catch_capture.hpp
@@ -14,7 +14,6 @@
 #include "catch_debugger.h"
 #include "catch_common.h"
 #include "catch_tostring.h"
-#include "catch_interfaces_runner.h"
 #include "catch_compiler_capabilities.h"
 
 
diff --git a/include/internal/catch_context.h b/include/internal/catch_context.h
index 75f9df54..6c306278 100644
--- a/include/internal/catch_context.h
+++ b/include/internal/catch_context.h
@@ -19,7 +19,6 @@ namespace Catch {
     class TestCase;
     class Stream;
     struct IRunContext;
-    struct IRunner;
     struct IConfig;
 
     struct IContext
@@ -27,7 +26,6 @@ namespace Catch {
         virtual ~IContext();
 
         virtual IRunContext* getCurrentRunContext() = 0;
-        virtual IRunner* getRunner() = 0;
         virtual IConfig const* getConfig() const = 0;
     };
 
@@ -35,7 +33,6 @@ namespace Catch {
     {
         virtual ~IMutableContext();
         virtual void setResultCapture( IRunContext* resultCapture ) = 0;
-        virtual void setRunner( IRunner* runner ) = 0;
         virtual void setConfig( Ptr<IConfig const> const& config ) = 0;
     };
 
diff --git a/include/internal/catch_context_impl.hpp b/include/internal/catch_context_impl.hpp
index cbf8758e..5d6f8732 100644
--- a/include/internal/catch_context_impl.hpp
+++ b/include/internal/catch_context_impl.hpp
@@ -17,7 +17,7 @@ namespace Catch {
 
     class Context : public IMutableContext {
 
-        Context() : m_config( CATCH_NULL ), m_runner( CATCH_NULL ), m_resultCapture( CATCH_NULL ) {}
+        Context() : m_config( CATCH_NULL ), m_resultCapture( CATCH_NULL ) {}
         Context( Context const& );
         void operator=( Context const& );
 
@@ -25,9 +25,6 @@ namespace Catch {
         virtual IRunContext* getCurrentRunContext() {
             return m_resultCapture;
         }
-        virtual IRunner* getRunner() {
-            return m_runner;
-        }
         virtual IConfig const* getConfig() const {
             return m_config.get();
         }
@@ -36,9 +33,6 @@ namespace Catch {
         virtual void setResultCapture( IRunContext* resultCapture ) {
             m_resultCapture = resultCapture;
         }
-        virtual void setRunner( IRunner* runner ) {
-            m_runner = runner;
-        }
         virtual void setConfig( Ptr<IConfig const> const& config ) {
             m_config = config;
         }
@@ -47,7 +41,6 @@ namespace Catch {
 
     private:
         Ptr<IConfig const> m_config;
-        IRunner* m_runner;
         IRunContext* m_resultCapture;
     };
 
diff --git a/include/internal/catch_impl.hpp b/include/internal/catch_impl.hpp
index 925f9554..fef21bcc 100644
--- a/include/internal/catch_impl.hpp
+++ b/include/internal/catch_impl.hpp
@@ -75,7 +75,6 @@ namespace Catch {
     StreamingReporterBase::~StreamingReporterBase() {}
     ConsoleReporter::~ConsoleReporter() {}
     CompactReporter::~CompactReporter() {}
-    IRunner::~IRunner() {}
     IMutableContext::~IMutableContext() {}
     IConfig::~IConfig() {}
     XmlReporter::~XmlReporter() {}
diff --git a/include/internal/catch_interfaces_capture.h b/include/internal/catch_interfaces_capture.h
index 515b9f68..2be3f92d 100644
--- a/include/internal/catch_interfaces_capture.h
+++ b/include/internal/catch_interfaces_capture.h
@@ -35,10 +35,11 @@ namespace Catch {
         virtual void pushScopedMessage( MessageInfo const& message ) = 0;
         virtual void popScopedMessage( MessageInfo const& message ) = 0;
 
+        virtual void handleFatalErrorCondition( std::string const& message ) = 0;
+        
         virtual std::string getCurrentTestName() const = 0;
         virtual const AssertionResult* getLastResult() const = 0;
-
-        virtual void handleFatalErrorCondition( std::string const& message ) = 0;
+        virtual bool isAborting() const = 0;
     };
 
     IRunContext& getCurrentRunContext();
diff --git a/include/internal/catch_interfaces_runner.h b/include/internal/catch_interfaces_runner.h
deleted file mode 100644
index 25decfb0..00000000
--- a/include/internal/catch_interfaces_runner.h
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- *  Created by Phil on 07/01/2011.
- *  Copyright 2011 Two Blue Cubes Ltd. All rights reserved.
- *
- *  Distributed under the Boost Software License, Version 1.0. (See accompanying
- *  file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
- */
-#ifndef TWOBLUECUBES_CATCH_INTERFACES_RUNNER_H_INCLUDED
-#define TWOBLUECUBES_CATCH_INTERFACES_RUNNER_H_INCLUDED
-
-namespace Catch {
-    class TestCase;
-
-    struct IRunner {
-        virtual ~IRunner();
-        virtual bool aborting() const = 0;
-    };
-}
-
-#endif // TWOBLUECUBES_CATCH_INTERFACES_RUNNER_H_INCLUDED
diff --git a/include/internal/catch_result_builder.hpp b/include/internal/catch_result_builder.hpp
index 429e8bd9..bedaa734 100644
--- a/include/internal/catch_result_builder.hpp
+++ b/include/internal/catch_result_builder.hpp
@@ -11,7 +11,6 @@
 #include "catch_result_builder.h"
 #include "catch_context.h"
 #include "catch_interfaces_config.h"
-#include "catch_interfaces_runner.h"
 #include "catch_interfaces_capture.h"
 #include "catch_interfaces_registry_hub.h"
 #include "catch_wildcard_pattern.hpp"
@@ -103,7 +102,7 @@ namespace Catch {
         if( !result.isOk() ) {
             if( getCurrentConfig()->shouldDebugBreak() )
                 m_shouldDebugBreak = true;
-            if( getCurrentContext().getRunner()->aborting() || (m_assertionInfo.resultDisposition & ResultDisposition::Normal) )
+            if( getCurrentContext().getCurrentRunContext()->isAborting() || (m_assertionInfo.resultDisposition & ResultDisposition::Normal) )
                 m_shouldThrow = true;
         }
     }
diff --git a/include/internal/catch_run_context.hpp b/include/internal/catch_run_context.hpp
index ed334ae8..3acd3b89 100644
--- a/include/internal/catch_run_context.hpp
+++ b/include/internal/catch_run_context.hpp
@@ -8,7 +8,6 @@
 #ifndef TWOBLUECUBES_CATCH_RUNNER_IMPL_HPP_INCLUDED
 #define TWOBLUECUBES_CATCH_RUNNER_IMPL_HPP_INCLUDED
 
-#include "catch_interfaces_runner.h"
 #include "catch_interfaces_reporter.h"
 #include "catch_interfaces_exception.h"
 #include "catch_config.hpp"
@@ -52,7 +51,7 @@ namespace Catch {
 
     ///////////////////////////////////////////////////////////////////////////
 
-    class RunContext : public IRunContext, public IRunner {
+    class RunContext : public IRunContext {
 
         RunContext( RunContext const& );
         void operator =( RunContext const& );
@@ -66,21 +65,20 @@ namespace Catch {
             m_reporter( reporter ),
             m_activeTestCaseInfo( CATCH_NULL )
         {
-            m_context.setRunner( this );
             m_context.setConfig( m_config );
             m_context.setResultCapture( this );
             m_reporter->testRunStarting( m_runInfo );
         }
 
         virtual ~RunContext() {
-            m_reporter->testRunEnded( TestRunStats( m_runInfo, m_totals, aborting() ) );
+            m_reporter->testRunEnded( TestRunStats( m_runInfo, m_totals, isAborting() ) );
         }
 
         void testGroupStarting( std::string const& testSpec, std::size_t groupIndex, std::size_t groupsCount ) {
             m_reporter->testGroupStarting( GroupInfo( testSpec, groupIndex, groupsCount ) );
         }
         void testGroupEnded( std::string const& testSpec, Totals const& totals, std::size_t groupIndex, std::size_t groupsCount ) {
-            m_reporter->testGroupEnded( TestGroupStats( GroupInfo( testSpec, groupIndex, groupsCount ), totals, aborting() ) );
+            m_reporter->testGroupEnded( TestGroupStats( GroupInfo( testSpec, groupIndex, groupsCount ), totals, isAborting() ) );
         }
 
         Totals runTest( TestCase const& testCase ) {
@@ -99,7 +97,7 @@ namespace Catch {
                 m_testCaseTracker = &SectionTracker::acquire( m_trackerContext, testCase.name );
                 runTest( testCase, redirectedCout, redirectedCerr );
             }
-            while( !m_testCaseTracker->isSuccessfullyCompleted() && !aborting() );
+            while( !m_testCaseTracker->isSuccessfullyCompleted() && !isAborting() );
 
             
             Totals deltaTotals = m_totals.delta( prevTotals );
@@ -108,7 +106,7 @@ namespace Catch {
                                                         deltaTotals,
                                                         redirectedCout,
                                                         redirectedCerr,
-                                                        aborting() ) );
+                                                        isAborting() ) );
 
             m_activeTestCaseInfo = CATCH_NULL;
 
@@ -243,7 +241,7 @@ namespace Catch {
 
     public:
         // !TBD We need to do this another way!
-        bool aborting() const {
+        bool isAborting() const {
             return m_totals.assertions.failed == static_cast<std::size_t>( m_config->abortAfter() );
         }
 
diff --git a/projects/SelfTest/SurrogateCpps/catch_interfaces_runner.cpp b/projects/SelfTest/SurrogateCpps/catch_interfaces_runner.cpp
deleted file mode 100644
index 401de262..00000000
--- a/projects/SelfTest/SurrogateCpps/catch_interfaces_runner.cpp
+++ /dev/null
@@ -1 +0,0 @@
-#include "catch_interfaces_runner.h"
diff --git a/projects/XCode/CatchSelfTest/CatchSelfTest.xcodeproj/project.pbxproj b/projects/XCode/CatchSelfTest/CatchSelfTest.xcodeproj/project.pbxproj
index 82849bb4..e7c3d0b7 100644
--- a/projects/XCode/CatchSelfTest/CatchSelfTest.xcodeproj/project.pbxproj
+++ b/projects/XCode/CatchSelfTest/CatchSelfTest.xcodeproj/project.pbxproj
@@ -27,7 +27,6 @@
 		4A45DA2D16161FA2004F8D6B /* catch_interfaces_capture.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4A45DA2C16161FA2004F8D6B /* catch_interfaces_capture.cpp */; };
 		4A45DA3116161FFC004F8D6B /* catch_interfaces_reporter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4A45DA3016161FFB004F8D6B /* catch_interfaces_reporter.cpp */; };
 		4A45DA3316162047004F8D6B /* catch_interfaces_exception.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4A45DA3216162047004F8D6B /* catch_interfaces_exception.cpp */; };
-		4A45DA3516162071004F8D6B /* catch_interfaces_runner.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4A45DA3416162071004F8D6B /* catch_interfaces_runner.cpp */; };
 		4A6D0C27149B3D3B00DB3EAA /* CatchSelfTest.1 in CopyFiles */ = {isa = PBXBuildFile; fileRef = 4A6D0C26149B3D3B00DB3EAA /* CatchSelfTest.1 */; };
 		4A6D0C37149B3D9E00DB3EAA /* ApproxTests.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4A6D0C2D149B3D9E00DB3EAA /* ApproxTests.cpp */; };
 		4A6D0C38149B3D9E00DB3EAA /* ClassTests.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4A6D0C2F149B3D9E00DB3EAA /* ClassTests.cpp */; };
@@ -120,7 +119,6 @@
 		4A45DA2C16161FA2004F8D6B /* catch_interfaces_capture.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = catch_interfaces_capture.cpp; path = ../../../SelfTest/SurrogateCpps/catch_interfaces_capture.cpp; sourceTree = "<group>"; };
 		4A45DA3016161FFB004F8D6B /* catch_interfaces_reporter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = catch_interfaces_reporter.cpp; path = ../../../SelfTest/SurrogateCpps/catch_interfaces_reporter.cpp; sourceTree = "<group>"; };
 		4A45DA3216162047004F8D6B /* catch_interfaces_exception.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = catch_interfaces_exception.cpp; path = ../../../SelfTest/SurrogateCpps/catch_interfaces_exception.cpp; sourceTree = "<group>"; };
-		4A45DA3416162071004F8D6B /* catch_interfaces_runner.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = catch_interfaces_runner.cpp; path = ../../../SelfTest/SurrogateCpps/catch_interfaces_runner.cpp; sourceTree = "<group>"; };
 		4A4B0F9715CE6CFB00AE2392 /* catch_registry_hub.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; lineEnding = 0; path = catch_registry_hub.hpp; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.cpp; };
 		4A4B0F9915CE6EC100AE2392 /* catch_interfaces_registry_hub.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = catch_interfaces_registry_hub.h; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
 		4A4B0F9A15CEF84800AE2392 /* catch_notimplemented_exception.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = catch_notimplemented_exception.h; sourceTree = "<group>"; };
@@ -154,7 +152,6 @@
 		4A6D0C53149B3E3D00DB3EAA /* catch_interfaces_capture.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = catch_interfaces_capture.h; sourceTree = "<group>"; };
 		4A6D0C54149B3E3D00DB3EAA /* catch_interfaces_exception.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = catch_interfaces_exception.h; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
 		4A6D0C55149B3E3D00DB3EAA /* catch_interfaces_reporter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = catch_interfaces_reporter.h; sourceTree = "<group>"; };
-		4A6D0C56149B3E3D00DB3EAA /* catch_interfaces_runner.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = catch_interfaces_runner.h; sourceTree = "<group>"; };
 		4A6D0C57149B3E3D00DB3EAA /* catch_interfaces_testcase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = catch_interfaces_testcase.h; sourceTree = "<group>"; };
 		4A6D0C58149B3E3D00DB3EAA /* catch_list.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; lineEnding = 0; path = catch_list.hpp; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.cpp; };
 		4A6D0C59149B3E3D00DB3EAA /* catch_objc.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = catch_objc.hpp; sourceTree = "<group>"; };
@@ -337,7 +334,6 @@
 				4A45DA2C16161FA2004F8D6B /* catch_interfaces_capture.cpp */,
 				4A45DA3216162047004F8D6B /* catch_interfaces_exception.cpp */,
 				4A45DA3016161FFB004F8D6B /* catch_interfaces_reporter.cpp */,
-				4A45DA3416162071004F8D6B /* catch_interfaces_runner.cpp */,
 				4AB3D99C1616216500C9A0F8 /* catch_interfaces_testcase.cpp */,
 				4AB3D99F1616219100C9A0F8 /* catch_interfaces_config.cpp */,
 				4AB3D9A1161621B500C9A0F8 /* catch_interfaces_generators.cpp */,
@@ -435,7 +431,6 @@
 				4A6D0C53149B3E3D00DB3EAA /* catch_interfaces_capture.h */,
 				4A6D0C54149B3E3D00DB3EAA /* catch_interfaces_exception.h */,
 				4A6D0C55149B3E3D00DB3EAA /* catch_interfaces_reporter.h */,
-				4A6D0C56149B3E3D00DB3EAA /* catch_interfaces_runner.h */,
 				4A6D0C57149B3E3D00DB3EAA /* catch_interfaces_testcase.h */,
 				4AFC661D157E96A7009D58CF /* catch_interfaces_config.h */,
 				26711C90195D46CD0033EDA2 /* catch_interfaces_tag_alias_registry.h */,
@@ -560,7 +555,6 @@
 				4A45DA3316162047004F8D6B /* catch_interfaces_exception.cpp in Sources */,
 				2691574C1A532A280054F1ED /* ToStringTuple.cpp in Sources */,
 				26711C8F195D465C0033EDA2 /* TagAliasTests.cpp in Sources */,
-				4A45DA3516162071004F8D6B /* catch_interfaces_runner.cpp in Sources */,
 				4AB3D99D1616216500C9A0F8 /* catch_interfaces_testcase.cpp in Sources */,
 				4AB3D9A01616219100C9A0F8 /* catch_interfaces_config.cpp in Sources */,
 				4AB3D9A2161621B500C9A0F8 /* catch_interfaces_generators.cpp in Sources */,