Rename config::colourMode to config::defaultConfigMode

This describes the actual intention much better.
This commit is contained in:
Martin Hořeňovský 2022-04-06 21:56:29 +02:00
parent c43947eb47
commit d5bfce4d84
No known key found for this signature in database
GPG Key ID: DE48307B8B0D381A
14 changed files with 45 additions and 46 deletions

View File

@ -127,7 +127,7 @@ namespace Catch {
uint32_t Config::rngSeed() const { return m_data.rngSeed; }
unsigned int Config::shardCount() const { return m_data.shardCount; }
unsigned int Config::shardIndex() const { return m_data.shardIndex; }
ColourMode Config::colourMode() const { return m_data.colourMode; }
ColourMode Config::defaultColourMode() const { return m_data.defaultColourMode; }
bool Config::shouldDebugBreak() const { return m_data.shouldDebugBreak; }
int Config::abortAfter() const { return m_data.abortAfter; }
bool Config::showInvisibles() const { return m_data.showInvisibles; }

View File

@ -56,7 +56,7 @@ namespace Catch {
ShowDurations showDurations = ShowDurations::DefaultForReporter;
double minDuration = -1;
TestRunOrder runOrder = TestRunOrder::Declared;
ColourMode colourMode = ColourMode::PlatformDefault;
ColourMode defaultColourMode = ColourMode::PlatformDefault;
WaitForKeypress::When waitForKeypress = WaitForKeypress::Never;
std::string defaultOutputFilename;
@ -104,7 +104,7 @@ namespace Catch {
uint32_t rngSeed() const override;
unsigned int shardCount() const override;
unsigned int shardIndex() const override;
ColourMode colourMode() const override;
ColourMode defaultColourMode() const override;
bool shouldDebugBreak() const override;
int abortAfter() const override;
bool showInvisibles() const override;

View File

@ -51,7 +51,7 @@ namespace Catch {
ReporterConfig(
config,
stream,
spec.colourMode().valueOr( config->colourMode() ),
spec.colourMode().valueOr( config->defaultColourMode() ),
spec.customOptions() ) );
}
@ -70,7 +70,7 @@ namespace Catch {
ReporterConfig( config,
stream,
reporterSpec.colourMode().valueOr(
config->colourMode() ),
config->defaultColourMode() ),
reporterSpec.customOptions() ) ) );
reporterIdx++;
}

View File

@ -84,7 +84,7 @@ namespace Catch {
virtual uint32_t rngSeed() const = 0;
virtual unsigned int shardCount() const = 0;
virtual unsigned int shardIndex() const = 0;
virtual ColourMode colourMode() const = 0;
virtual ColourMode defaultColourMode() const = 0;
virtual std::vector<std::string> const& getSectionsToRun() const = 0;
virtual Verbosity verbosity() const = 0;

View File

@ -97,8 +97,7 @@ namespace Catch {
return ParserResult::runtimeError("Could not parse '" + seed + "' as seed");
}
};
auto const setColourMode = [&]( std::string const&
colourMode ) {
auto const setDefaultColourMode = [&]( std::string const& colourMode ) {
Optional<ColourMode> maybeMode = Catch::Detail::stringToColourMode(toLower( colourMode ));
if ( !maybeMode ) {
return ParserResult::runtimeError(
@ -112,7 +111,7 @@ namespace Catch {
"colour mode '" + colourMode +
"' is not supported in this binary" );
}
config.colourMode = mode;
config.defaultColourMode = mode;
return ParserResult::ok( ParseResultType::Matched );
};
auto const setWaitForKeypress = [&]( std::string const& keypress ) {
@ -290,7 +289,7 @@ namespace Catch {
| Opt( setRngSeed, "'time'|'random-device'|number" )
["--rng-seed"]
( "set a specific seed for random numbers" )
| Opt( setColourMode, "ansi|win32|none|default" )
| Opt( setDefaultColourMode, "ansi|win32|none|default" )
["--colour-mode"]
( "what color mode should be used as default" )
| Opt( config.libIdentify )

View File

@ -1381,13 +1381,13 @@ CmdLine.tests.cpp:<line number>: passed: config.abortAfter == 1 for: 1 == 1
CmdLine.tests.cpp:<line number>: passed: config.shouldDebugBreak for: true
CmdLine.tests.cpp:<line number>: passed: config.noThrow == true for: true == true
CmdLine.tests.cpp:<line number>: passed: cli.parse({"test"}) for: {?}
CmdLine.tests.cpp:<line number>: passed: config.colourMode == ColourMode::PlatformDefault for: 0 == 0
CmdLine.tests.cpp:<line number>: passed: config.defaultColourMode == ColourMode::PlatformDefault for: 0 == 0
CmdLine.tests.cpp:<line number>: passed: cli.parse( { "test", "--colour-mode", "default" } ) for: {?}
CmdLine.tests.cpp:<line number>: passed: config.colourMode == ColourMode::PlatformDefault for: 0 == 0
CmdLine.tests.cpp:<line number>: passed: config.defaultColourMode == ColourMode::PlatformDefault for: 0 == 0
CmdLine.tests.cpp:<line number>: passed: cli.parse({"test", "--colour-mode", "ansi"}) for: {?}
CmdLine.tests.cpp:<line number>: passed: config.colourMode == ColourMode::ANSI for: 1 == 1
CmdLine.tests.cpp:<line number>: passed: config.defaultColourMode == ColourMode::ANSI for: 1 == 1
CmdLine.tests.cpp:<line number>: passed: cli.parse({"test", "--colour-mode", "none"}) for: {?}
CmdLine.tests.cpp:<line number>: passed: config.colourMode == ColourMode::None for: 3 == 3
CmdLine.tests.cpp:<line number>: passed: config.defaultColourMode == ColourMode::None for: 3 == 3
CmdLine.tests.cpp:<line number>: passed: !result for: true
CmdLine.tests.cpp:<line number>: passed: result.errorMessage(), ContainsSubstring( "colour mode must be one of" ) for: "colour mode must be one of: default, ansi, win32, or none. 'wrong' is not recognised" contains: "colour mode must be one of"
CmdLine.tests.cpp:<line number>: passed: cli.parse({ "test", "--benchmark-samples=200" }) for: {?}

View File

@ -1379,13 +1379,13 @@ CmdLine.tests.cpp:<line number>: passed: config.abortAfter == 1 for: 1 == 1
CmdLine.tests.cpp:<line number>: passed: config.shouldDebugBreak for: true
CmdLine.tests.cpp:<line number>: passed: config.noThrow == true for: true == true
CmdLine.tests.cpp:<line number>: passed: cli.parse({"test"}) for: {?}
CmdLine.tests.cpp:<line number>: passed: config.colourMode == ColourMode::PlatformDefault for: 0 == 0
CmdLine.tests.cpp:<line number>: passed: config.defaultColourMode == ColourMode::PlatformDefault for: 0 == 0
CmdLine.tests.cpp:<line number>: passed: cli.parse( { "test", "--colour-mode", "default" } ) for: {?}
CmdLine.tests.cpp:<line number>: passed: config.colourMode == ColourMode::PlatformDefault for: 0 == 0
CmdLine.tests.cpp:<line number>: passed: config.defaultColourMode == ColourMode::PlatformDefault for: 0 == 0
CmdLine.tests.cpp:<line number>: passed: cli.parse({"test", "--colour-mode", "ansi"}) for: {?}
CmdLine.tests.cpp:<line number>: passed: config.colourMode == ColourMode::ANSI for: 1 == 1
CmdLine.tests.cpp:<line number>: passed: config.defaultColourMode == ColourMode::ANSI for: 1 == 1
CmdLine.tests.cpp:<line number>: passed: cli.parse({"test", "--colour-mode", "none"}) for: {?}
CmdLine.tests.cpp:<line number>: passed: config.colourMode == ColourMode::None for: 3 == 3
CmdLine.tests.cpp:<line number>: passed: config.defaultColourMode == ColourMode::None for: 3 == 3
CmdLine.tests.cpp:<line number>: passed: !result for: true
CmdLine.tests.cpp:<line number>: passed: result.errorMessage(), ContainsSubstring( "colour mode must be one of" ) for: "colour mode must be one of: default, ansi, win32, or none. 'wrong' is not recognised" contains: "colour mode must be one of"
CmdLine.tests.cpp:<line number>: passed: cli.parse({ "test", "--benchmark-samples=200" }) for: {?}

View File

@ -10014,7 +10014,7 @@ with expansion:
{?}
CmdLine.tests.cpp:<line number>: PASSED:
REQUIRE( config.colourMode == ColourMode::PlatformDefault )
REQUIRE( config.defaultColourMode == ColourMode::PlatformDefault )
with expansion:
0 == 0
@ -10032,7 +10032,7 @@ with expansion:
{?}
CmdLine.tests.cpp:<line number>: PASSED:
REQUIRE( config.colourMode == ColourMode::PlatformDefault )
REQUIRE( config.defaultColourMode == ColourMode::PlatformDefault )
with expansion:
0 == 0
@ -10050,7 +10050,7 @@ with expansion:
{?}
CmdLine.tests.cpp:<line number>: PASSED:
REQUIRE( config.colourMode == ColourMode::ANSI )
REQUIRE( config.defaultColourMode == ColourMode::ANSI )
with expansion:
1 == 1
@ -10068,7 +10068,7 @@ with expansion:
{?}
CmdLine.tests.cpp:<line number>: PASSED:
REQUIRE( config.colourMode == ColourMode::None )
REQUIRE( config.defaultColourMode == ColourMode::None )
with expansion:
3 == 3

View File

@ -10012,7 +10012,7 @@ with expansion:
{?}
CmdLine.tests.cpp:<line number>: PASSED:
REQUIRE( config.colourMode == ColourMode::PlatformDefault )
REQUIRE( config.defaultColourMode == ColourMode::PlatformDefault )
with expansion:
0 == 0
@ -10030,7 +10030,7 @@ with expansion:
{?}
CmdLine.tests.cpp:<line number>: PASSED:
REQUIRE( config.colourMode == ColourMode::PlatformDefault )
REQUIRE( config.defaultColourMode == ColourMode::PlatformDefault )
with expansion:
0 == 0
@ -10048,7 +10048,7 @@ with expansion:
{?}
CmdLine.tests.cpp:<line number>: PASSED:
REQUIRE( config.colourMode == ColourMode::ANSI )
REQUIRE( config.defaultColourMode == ColourMode::ANSI )
with expansion:
1 == 1
@ -10066,7 +10066,7 @@ with expansion:
{?}
CmdLine.tests.cpp:<line number>: PASSED:
REQUIRE( config.colourMode == ColourMode::None )
REQUIRE( config.defaultColourMode == ColourMode::None )
with expansion:
3 == 3

View File

@ -2609,19 +2609,19 @@ ok {test-number} - config.noThrow == true for: true == true
# Process can be configured on command line
ok {test-number} - cli.parse({"test"}) for: {?}
# Process can be configured on command line
ok {test-number} - config.colourMode == ColourMode::PlatformDefault for: 0 == 0
ok {test-number} - config.defaultColourMode == ColourMode::PlatformDefault for: 0 == 0
# Process can be configured on command line
ok {test-number} - cli.parse( { "test", "--colour-mode", "default" } ) for: {?}
# Process can be configured on command line
ok {test-number} - config.colourMode == ColourMode::PlatformDefault for: 0 == 0
ok {test-number} - config.defaultColourMode == ColourMode::PlatformDefault for: 0 == 0
# Process can be configured on command line
ok {test-number} - cli.parse({"test", "--colour-mode", "ansi"}) for: {?}
# Process can be configured on command line
ok {test-number} - config.colourMode == ColourMode::ANSI for: 1 == 1
ok {test-number} - config.defaultColourMode == ColourMode::ANSI for: 1 == 1
# Process can be configured on command line
ok {test-number} - cli.parse({"test", "--colour-mode", "none"}) for: {?}
# Process can be configured on command line
ok {test-number} - config.colourMode == ColourMode::None for: 3 == 3
ok {test-number} - config.defaultColourMode == ColourMode::None for: 3 == 3
# Process can be configured on command line
ok {test-number} - !result for: true
# Process can be configured on command line

View File

@ -2607,19 +2607,19 @@ ok {test-number} - config.noThrow == true for: true == true
# Process can be configured on command line
ok {test-number} - cli.parse({"test"}) for: {?}
# Process can be configured on command line
ok {test-number} - config.colourMode == ColourMode::PlatformDefault for: 0 == 0
ok {test-number} - config.defaultColourMode == ColourMode::PlatformDefault for: 0 == 0
# Process can be configured on command line
ok {test-number} - cli.parse( { "test", "--colour-mode", "default" } ) for: {?}
# Process can be configured on command line
ok {test-number} - config.colourMode == ColourMode::PlatformDefault for: 0 == 0
ok {test-number} - config.defaultColourMode == ColourMode::PlatformDefault for: 0 == 0
# Process can be configured on command line
ok {test-number} - cli.parse({"test", "--colour-mode", "ansi"}) for: {?}
# Process can be configured on command line
ok {test-number} - config.colourMode == ColourMode::ANSI for: 1 == 1
ok {test-number} - config.defaultColourMode == ColourMode::ANSI for: 1 == 1
# Process can be configured on command line
ok {test-number} - cli.parse({"test", "--colour-mode", "none"}) for: {?}
# Process can be configured on command line
ok {test-number} - config.colourMode == ColourMode::None for: 3 == 3
ok {test-number} - config.defaultColourMode == ColourMode::None for: 3 == 3
# Process can be configured on command line
ok {test-number} - !result for: true
# Process can be configured on command line

View File

@ -12208,7 +12208,7 @@ C
</Expression>
<Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
<Original>
config.colourMode == ColourMode::PlatformDefault
config.defaultColourMode == ColourMode::PlatformDefault
</Original>
<Expanded>
0 == 0
@ -12230,7 +12230,7 @@ C
</Expression>
<Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
<Original>
config.colourMode == ColourMode::PlatformDefault
config.defaultColourMode == ColourMode::PlatformDefault
</Original>
<Expanded>
0 == 0
@ -12252,7 +12252,7 @@ C
</Expression>
<Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
<Original>
config.colourMode == ColourMode::ANSI
config.defaultColourMode == ColourMode::ANSI
</Original>
<Expanded>
1 == 1
@ -12274,7 +12274,7 @@ C
</Expression>
<Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
<Original>
config.colourMode == ColourMode::None
config.defaultColourMode == ColourMode::None
</Original>
<Expanded>
3 == 3

View File

@ -12208,7 +12208,7 @@ C
</Expression>
<Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
<Original>
config.colourMode == ColourMode::PlatformDefault
config.defaultColourMode == ColourMode::PlatformDefault
</Original>
<Expanded>
0 == 0
@ -12230,7 +12230,7 @@ C
</Expression>
<Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
<Original>
config.colourMode == ColourMode::PlatformDefault
config.defaultColourMode == ColourMode::PlatformDefault
</Original>
<Expanded>
0 == 0
@ -12252,7 +12252,7 @@ C
</Expression>
<Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
<Original>
config.colourMode == ColourMode::ANSI
config.defaultColourMode == ColourMode::ANSI
</Original>
<Expanded>
1 == 1
@ -12274,7 +12274,7 @@ C
</Expression>
<Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
<Original>
config.colourMode == ColourMode::None
config.defaultColourMode == ColourMode::None
</Original>
<Expanded>
3 == 3

View File

@ -566,25 +566,25 @@ TEST_CASE( "Process can be configured on command line", "[config][command-line]"
SECTION( "without option" ) {
CHECK(cli.parse({"test"}));
REQUIRE( config.colourMode == ColourMode::PlatformDefault );
REQUIRE( config.defaultColourMode == ColourMode::PlatformDefault );
}
SECTION( "auto" ) {
CHECK( cli.parse( { "test", "--colour-mode", "default" } ) );
REQUIRE( config.colourMode == ColourMode::PlatformDefault );
REQUIRE( config.defaultColourMode == ColourMode::PlatformDefault );
}
SECTION( "yes" ) {
CHECK(cli.parse({"test", "--colour-mode", "ansi"}));
REQUIRE( config.colourMode == ColourMode::ANSI );
REQUIRE( config.defaultColourMode == ColourMode::ANSI );
}
SECTION( "no" ) {
CHECK(cli.parse({"test", "--colour-mode", "none"}));
REQUIRE( config.colourMode == ColourMode::None );
REQUIRE( config.defaultColourMode == ColourMode::None );
}
SECTION( "error" ) {