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

summaryrefslogtreecommitdiffhomepage
path: root/tests/SelfTest
diff options
context:
space:
mode:
authorMartin Hořeňovský2022-04-04 15:23:30 +0200
committerMartin Hořeňovský2022-04-05 13:42:06 +0200
commitd750da13a8ca2ffcd00ba49d52ee8044287aa31b (patch)
tree1d620281ecc0ac923545aac6a5c96b57fcc954d8 /tests/SelfTest
parentc045733d058c505c65ee83edff942f6e70c38411 (diff)
downloadcatch3-d750da13a8ca2ffcd00ba49d52ee8044287aa31b.tar.gz
Split out colour mode string parsing into its own function
Diffstat (limited to 'tests/SelfTest')
-rw-r--r--tests/SelfTest/IntrospectiveTests/CmdLineHelpers.tests.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/SelfTest/IntrospectiveTests/CmdLineHelpers.tests.cpp b/tests/SelfTest/IntrospectiveTests/CmdLineHelpers.tests.cpp
index b79dcca2..0eacfdf3 100644
--- a/tests/SelfTest/IntrospectiveTests/CmdLineHelpers.tests.cpp
+++ b/tests/SelfTest/IntrospectiveTests/CmdLineHelpers.tests.cpp
@@ -9,6 +9,7 @@
#include <catch2/catch_test_macros.hpp>
#include <catch2/internal/catch_reporter_spec_parser.hpp>
#include <catch2/matchers/catch_matchers_vector.hpp>
+#include <catch2/interfaces/catch_interfaces_config.hpp>
TEST_CASE("Reporter spec splitting", "[reporter-spec][cli][approvals]") {
using Catch::Detail::splitReporterSpec;
@@ -44,3 +45,20 @@ TEST_CASE("Reporter spec splitting", "[reporter-spec][cli][approvals]") {
"key:key=value:value"s } ) );
}
}
+
+TEST_CASE( "Parsing colour mode", "[cli][colour][approvals]" ) {
+ using Catch::Detail::stringToColourMode;
+ using Catch::ColourMode;
+ SECTION("Valid strings") {
+ REQUIRE( stringToColourMode( "none" ) == ColourMode::None );
+ REQUIRE( stringToColourMode( "ansi" ) == ColourMode::ANSI );
+ REQUIRE( stringToColourMode( "win32" ) == ColourMode::Win32 );
+ REQUIRE( stringToColourMode( "default" ) ==
+ ColourMode::PlatformDefault );
+ }
+ SECTION("Wrong strings") {
+ REQUIRE_FALSE( stringToColourMode( "NONE" ) );
+ REQUIRE_FALSE( stringToColourMode( "-" ) );
+ REQUIRE_FALSE( stringToColourMode( "asdbjsdb kasbd" ) );
+ }
+}