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

More config refactoring

Commit
3c3beb57c36b5d55c05f4af164f28d7fd76db249
Author
Phil Nash ·
Parents
be8fd82f2021

Files · Download .tar.gz

Changes

 include/internal/catch_commandline.hpp          |  4 +--
 include/internal/catch_config.hpp               | 12 ++++----
 projects/SelfTest/Baselines/approvedResults.txt | 40 ++++++++++++-------------
 projects/SelfTest/TestMain.cpp                  |  8 ++---
 4 files changed, 32 insertions(+), 32 deletions(-)

diff --git a/include/internal/catch_commandline.hpp b/include/internal/catch_commandline.hpp
index 6c050f55..2eda8912 100644
--- a/include/internal/catch_commandline.hpp
+++ b/include/internal/catch_commandline.hpp
@@ -466,7 +466,7 @@ namespace Catch {
                     "just pass this option.";
             }
             virtual void parseIntoConfig( Command const&, ConfigData& config ) {
-                config.includeWhichResults = Include::SuccessfulResults;
+                config.showSuccessfulTests = true;
             }
         };
         
@@ -590,7 +590,7 @@ namespace Catch {
             }
 
             virtual void parseIntoConfig( Command const&, ConfigData& config ) {
-                config.allowThrows = false;
+                config.noThrow = true;
             }
         };
 
diff --git a/include/internal/catch_config.hpp b/include/internal/catch_config.hpp
index 7c88edd8..141ac437 100644
--- a/include/internal/catch_config.hpp
+++ b/include/internal/catch_config.hpp
@@ -59,17 +59,17 @@ namespace Catch {
 
         ConfigData()
         :   listSpec( List::None ),
-            includeWhichResults( Include::FailedOnly ),
+            showSuccessfulTests( false ),
             shouldDebugBreak( false ),
-            allowThrows( true ),
+            noThrow( false ),
             cutoff( -1 ),
             warnings( WarnAbout::Nothing )
         {}
         
         List::What listSpec; // !TBD Split into bools
-        Include::WhichResults includeWhichResults; // !TBD bool
+        bool showSuccessfulTests;
         bool shouldDebugBreak;
-        bool allowThrows; // !TBD invert
+        bool noThrow;
 //        bool showHelp; // !TBD
 
         int cutoff;
@@ -159,10 +159,10 @@ namespace Catch {
         }
 
         // IConfig interface
-        virtual bool allowThrows() const        { return m_data.allowThrows; }
+        virtual bool allowThrows() const        { return !m_data.noThrow; }
         virtual std::ostream& stream() const    { return m_os; }
         virtual std::string name() const        { return m_data.name; }
-        virtual bool includeSuccessfulResults() const   { return m_data.includeWhichResults == Include::SuccessfulResults; }
+        virtual bool includeSuccessfulResults() const   { return m_data.showSuccessfulTests; }
         virtual bool warnAboutMissingAssertions() const { return m_data.warnings & ConfigData::WarnAbout::NoAssertions; }
 
     private:
diff --git a/projects/SelfTest/Baselines/approvedResults.txt b/projects/SelfTest/Baselines/approvedResults.txt
index e5304af8..d599d648 100644
--- a/projects/SelfTest/Baselines/approvedResults.txt
+++ b/projects/SelfTest/Baselines/approvedResults.txt
@@ -3564,9 +3564,9 @@ with expansion:
 
 TestMain.cpp:102:
 PASSED:
-  CHECK( config.allowThrows == true )
+  CHECK( config.noThrow == false )
 with expansion:
-  true == true
+  false == false
 
 TestMain.cpp:103:
 PASSED:
@@ -3990,9 +3990,9 @@ PASSED:
 
 TestMain.cpp:243:
 PASSED:
-  REQUIRE( config.allowThrows == false )
+  REQUIRE( config.noThrow == true )
 with expansion:
-  false == false
+  true == true
 
 -------------------------------------------------------------------------------
 selftest/parser/2
@@ -4008,9 +4008,9 @@ PASSED:
 
 TestMain.cpp:249:
 PASSED:
-  REQUIRE( config.allowThrows == false )
+  REQUIRE( config.noThrow == true )
 with expansion:
-  false == false
+  true == true
 
 -------------------------------------------------------------------------------
 selftest/parser/2
@@ -4104,9 +4104,9 @@ with expansion:
 
 TestMain.cpp:283:
 PASSED:
-  CHECK( config.allowThrows == false )
+  CHECK( config.noThrow == true )
 with expansion:
-  false == false
+  true == true
 
 -------------------------------------------------------------------------------
 selftest/test filter
@@ -10636,10 +10636,10 @@ TestMain.cpp" line="101">
         </Expression>
 TestMain.cpp" line="102">
           <Original>
-            config.allowThrows == true
+            config.noThrow == false
           </Original>
           <Expanded>
-            true == true
+            false == false
           </Expanded>
         </Expression>
 TestMain.cpp" line="103">
@@ -11150,10 +11150,10 @@ TestMain.cpp" line="241">
           </Expression>
 TestMain.cpp" line="243">
             <Original>
-              config.allowThrows == false
+              config.noThrow == true
             </Original>
             <Expanded>
-              false == false
+              true == true
             </Expanded>
           </Expression>
           <OverallResults successes="2" failures="0"/>
@@ -11172,10 +11172,10 @@ TestMain.cpp" line="247">
           </Expression>
 TestMain.cpp" line="249">
             <Original>
-              config.allowThrows == false
+              config.noThrow == true
             </Original>
             <Expanded>
-              false == false
+              true == true
             </Expanded>
           </Expression>
           <OverallResults successes="2" failures="0"/>
@@ -11298,10 +11298,10 @@ TestMain.cpp" line="282">
           </Expression>
 TestMain.cpp" line="283">
             <Original>
-              config.allowThrows == false
+              config.noThrow == true
             </Original>
             <Expanded>
-              false == false
+              true == true
             </Expanded>
           </Expression>
           <OverallResults successes="4" failures="0"/>
@@ -14258,7 +14258,7 @@ TestMain.cpp:59: totals.assertions.failed == 1 succeeded for: 1 == 1
 TestMain.cpp:98: parseIntoConfig( argv, config ) succeeded
 TestMain.cpp:100: config.shouldDebugBreak == false succeeded for: false == false
 TestMain.cpp:101: config.cutoff == -1 succeeded for: -1 == -1
-TestMain.cpp:102: config.allowThrows == true succeeded for: true == true
+TestMain.cpp:102: config.noThrow == false succeeded for: false == false
 TestMain.cpp:103: config.reporter.empty() succeeded for: true
 [End of section: 'default' All 5 assertions passed]
 
@@ -14430,7 +14430,7 @@ TestMain.cpp:234: parseIntoConfigAndReturnError( argv, config ) Contains( "0 and
 [Started section: 'nothrow']
 [Started section: '-nt']
 TestMain.cpp:241: parseIntoConfig( argv, config ) succeeded
-TestMain.cpp:243: config.allowThrows == false succeeded for: false == false
+TestMain.cpp:243: config.noThrow == true succeeded for: true == true
 [End of section: '-nt' All 2 assertions passed]
 
 [End of section: 'nothrow' All 2 assertions passed]
@@ -14438,7 +14438,7 @@ TestMain.cpp:243: config.allowThrows == false succeeded for: false == false
 [Started section: 'nothrow']
 [Started section: '--nothrow']
 TestMain.cpp:247: parseIntoConfig( argv, config ) succeeded
-TestMain.cpp:249: config.allowThrows == false succeeded for: false == false
+TestMain.cpp:249: config.noThrow == true succeeded for: true == true
 [End of section: '--nothrow' All 2 assertions passed]
 
 [End of section: 'nothrow' All 2 assertions passed]
@@ -14474,7 +14474,7 @@ TestMain.cpp:272: config.outputFilename == "filename.ext" succeeded for: "filena
 TestMain.cpp:279: parseIntoConfig( argv, config ) succeeded
 TestMain.cpp:281: config.cutoff == 1 succeeded for: 1 == 1
 TestMain.cpp:282: config.shouldDebugBreak succeeded for: true
-TestMain.cpp:283: config.allowThrows == false succeeded for: false == false
+TestMain.cpp:283: config.noThrow == true succeeded for: true == true
 [End of section: '-a -b' All 4 assertions passed]
 
 [End of section: 'combinations' All 4 assertions passed]
diff --git a/projects/SelfTest/TestMain.cpp b/projects/SelfTest/TestMain.cpp
index 7b31bbba..a0d941fc 100644
--- a/projects/SelfTest/TestMain.cpp
+++ b/projects/SelfTest/TestMain.cpp
@@ -99,7 +99,7 @@ TEST_CASE( "selftest/parser/2", "ConfigData" ) {
         
         CHECK( config.shouldDebugBreak == false );
         CHECK( config.cutoff == -1 );
-        CHECK( config.allowThrows == true );
+        CHECK( config.noThrow == false );
         CHECK( config.reporter.empty() );
     }
     
@@ -240,13 +240,13 @@ TEST_CASE( "selftest/parser/2", "ConfigData" ) {
             const char* argv[] = { "test", "-nt" };
             CHECK_NOTHROW( parseIntoConfig( argv, config ) );
 
-            REQUIRE( config.allowThrows == false );
+            REQUIRE( config.noThrow == true );
         }
         SECTION( "--nothrow", "" ) {
             const char* argv[] = { "test", "--nothrow" };
             CHECK_NOTHROW( parseIntoConfig( argv, config ) );
 
-            REQUIRE( config.allowThrows == false );
+            REQUIRE( config.noThrow == true );
         }
     }
 
@@ -280,7 +280,7 @@ TEST_CASE( "selftest/parser/2", "ConfigData" ) {
 
             CHECK( config.cutoff == 1 );
             CHECK( config.shouldDebugBreak );
-            CHECK( config.allowThrows == false );
+            CHECK( config.noThrow == true );
         }
     }        
 }