mirror of
				https://github.com/catchorg/Catch2.git
				synced 2025-11-03 21:49:32 +01:00 
			
		
		
		
	More config refactoring
This commit is contained in:
		@@ -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;
 | 
			
		||||
            }
 | 
			
		||||
        };
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -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:
 | 
			
		||||
 
 | 
			
		||||
@@ -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]
 | 
			
		||||
 
 | 
			
		||||
@@ -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 );
 | 
			
		||||
        }
 | 
			
		||||
    }        
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user