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

Main() functions deal with raw ConfigData

Commit
43fe6c6e9edae209947101295edcf0e9e217716c
Author
Phil Nash ·
Parents
ca9b92f8fa9a

Files · Download .tar.gz

Changes

 include/catch_runner.hpp | 24 +++++++-----------------
 1 file changed, 7 insertions(+), 17 deletions(-)

diff --git a/include/catch_runner.hpp b/include/catch_runner.hpp
index dd820fe2..1dfd21fc 100644
--- a/include/catch_runner.hpp
+++ b/include/catch_runner.hpp
@@ -24,8 +24,8 @@ namespace Catch {
     class Runner2 { // This will become Runner when Runner becomes Context
 
     public:
-        Runner2( Ptr<Config> const& config )
-        :   m_config( config )
+        Runner2( ConfigData const& config )
+        :   m_config( new Config( config ) )
         {
             openStream();
             makeReporter();
@@ -110,13 +110,11 @@ namespace Catch {
         std::set<TestCase> m_testsAlreadyRun;
     };
 
-    inline int Main( Ptr<Config> const& config ) {
+    inline int Main( ConfigData const& configData ) {
         int result = 0;
         try
         {
-            Runner2 runner( config );
-
-            const ConfigData& configData = config->data();
+            Runner2 runner( configData );
 
             // Handle list request
             if( configData.listSpec != List::None ) {
@@ -173,7 +171,7 @@ namespace Catch {
         }
     }
     
-    inline int Main( int argc, char* const argv[], Ptr<Config> const& config ) {
+    inline int Main( int argc, char* const argv[], ConfigData configData = ConfigData() ) {
 
         try {
             CommandParser parser( argc, argv );
@@ -189,7 +187,7 @@ namespace Catch {
 
             AllOptions options;
 
-            options.parseIntoConfig( parser, config->data() );
+            options.parseIntoConfig( parser, configData );
         }
         catch( std::exception& ex ) {
             std::cerr << ex.what() << "\n\nUsage: ...\n\n";
@@ -198,15 +196,7 @@ namespace Catch {
             return (std::numeric_limits<int>::max)();
         }
                 
-        return Main( config );
-    }
-    
-    inline int Main( int argc, char* const argv[] ) {
-        Ptr<Config> config = new Config();
-// !TBD: This doesn't always work, for some reason
-//        if( isDebuggerActive() )
-//            config.useStream( "debug" );
-        return Main( argc, argv, config );
+        return Main( configData );
     }
     
 } // end namespace Catch