mirror of
https://github.com/catchorg/Catch2.git
synced 2025-08-01 12:55:40 +02:00
Added --use-colour option to give finer control over colourisation.
--force-colour is still present but deprecated (will remove in v2)
This commit is contained in:
@@ -195,19 +195,41 @@ TEST_CASE( "Process can be configured on command line", "[config][command-line]"
|
||||
}
|
||||
}
|
||||
|
||||
SECTION( "force-colour", "") {
|
||||
SECTION( "--force-colour", "" ) {
|
||||
const char* argv[] = { "test", "--force-colour" };
|
||||
CHECK_NOTHROW( parseIntoConfig( argv, config ) );
|
||||
|
||||
REQUIRE( config.forceColour );
|
||||
}
|
||||
|
||||
SECTION( "without --force-colour", "" ) {
|
||||
SECTION( "use-colour", "") {
|
||||
|
||||
using Catch::UseColour;
|
||||
|
||||
SECTION( "without option", "" ) {
|
||||
const char* argv[] = { "test" };
|
||||
CHECK_NOTHROW( parseIntoConfig( argv, config ) );
|
||||
|
||||
REQUIRE( config.useColour == UseColour::Auto );
|
||||
}
|
||||
|
||||
REQUIRE( !config.forceColour );
|
||||
SECTION( "auto", "" ) {
|
||||
const char* argv[] = { "test", "--use-colour", "auto" };
|
||||
CHECK_NOTHROW( parseIntoConfig( argv, config ) );
|
||||
|
||||
REQUIRE( config.useColour == UseColour::Auto );
|
||||
}
|
||||
|
||||
SECTION( "yes", "" ) {
|
||||
const char* argv[] = { "test", "--use-colour", "yes" };
|
||||
CHECK_NOTHROW( parseIntoConfig( argv, config ) );
|
||||
|
||||
REQUIRE( config.useColour == UseColour::Yes );
|
||||
}
|
||||
|
||||
SECTION( "no", "" ) {
|
||||
const char* argv[] = { "test", "--use-colour", "no" };
|
||||
CHECK_NOTHROW( parseIntoConfig( argv, config ) );
|
||||
|
||||
REQUIRE( config.useColour == UseColour::No );
|
||||
}
|
||||
|
||||
SECTION( "error", "" ) {
|
||||
const char* argv[] = { "test", "--use-colour", "wrong" };
|
||||
REQUIRE_THROWS_WITH( parseIntoConfig( argv, config ), Contains( "colour mode must be one of" ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -93,7 +93,7 @@
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\..\SelfTest\ApproxTests.cpp" />
|
||||
<ClCompile Include="..\..\..\SelfTest\BDDTests.cpp" />
|
||||
<ClCompile Include="..\..\..\SelfTest\SectionTrackerTests.cpp" />
|
||||
<ClCompile Include="..\..\..\SelfTest\PartTrackerTests.cpp" />
|
||||
<ClCompile Include="..\..\..\SelfTest\TestMain.cpp" />
|
||||
<ClCompile Include="..\..\..\SelfTest\ClassTests.cpp" />
|
||||
<ClCompile Include="..\..\..\SelfTest\ConditionTests.cpp" />
|
||||
|
Reference in New Issue
Block a user