Read-only mirrors. Development, issues and pull requests are on GitHub.

summaryrefslogtreecommitdiffhomepage
path: root/projects/SelfTest/TestMain.cpp
diff options
context:
space:
mode:
authorPeter Huene2015-02-11 12:40:20 -0800
committerPeter Huene2015-02-11 13:12:42 -0800
commite5280b2c5722ab93419905d886e8675ee912bd25 (patch)
treefb8fc2ba54425bbe78ce840999c3d2769afc6d4d /projects/SelfTest/TestMain.cpp
parent7f5615272b0fb51bcd7a669e68f3b4c7a87d93bb (diff)
downloadcatch3-e5280b2c5722ab93419905d886e8675ee912bd25.tar.gz
Add --force-colour option to force colour output.
Adding a --force-colour option to force colour output on POSIX systems, provided a debugger is not attached. This allows for Catch to output colours even if STDOUT is not a tty, which can be the case when the test executable is being spawned by a parent process (e.g. CMake's ctest).
Diffstat (limited to 'projects/SelfTest/TestMain.cpp')
-rw-r--r--projects/SelfTest/TestMain.cpp18
1 files changed, 17 insertions, 1 deletions
diff --git a/projects/SelfTest/TestMain.cpp b/projects/SelfTest/TestMain.cpp
index 4b60a4f5..7cb7ca42 100644
--- a/projects/SelfTest/TestMain.cpp
+++ b/projects/SelfTest/TestMain.cpp
@@ -182,7 +182,23 @@ TEST_CASE( "Process can be configured on command line", "[config][command-line]"
CHECK( config.shouldDebugBreak );
CHECK( config.noThrow == true );
}
- }
+ }
+
+ SECTION( "force-colour", "") {
+ SECTION( "--force-colour", "" ) {
+ const char* argv[] = { "test", "--force-colour" };
+ CHECK_NOTHROW( parseIntoConfig( argv, config ) );
+
+ REQUIRE( config.forceColour );
+ }
+
+ SECTION( "without --force-colour", "" ) {
+ const char* argv[] = { "test" };
+ CHECK_NOTHROW( parseIntoConfig( argv, config ) );
+
+ REQUIRE( !config.forceColour );
+ }
+ }
}