diff options
| author | Martin Hořeňovský | 2022-04-04 15:23:30 +0200 |
|---|---|---|
| committer | Martin Hořeňovský | 2022-04-05 13:42:06 +0200 |
| commit | d750da13a8ca2ffcd00ba49d52ee8044287aa31b (patch) | |
| tree | 1d620281ecc0ac923545aac6a5c96b57fcc954d8 /src | |
| parent | c045733d058c505c65ee83edff942f6e70c38411 (diff) | |
| download | catch3-d750da13a8ca2ffcd00ba49d52ee8044287aa31b.tar.gz | |
Split out colour mode string parsing into its own function
Diffstat (limited to 'src')
| -rw-r--r-- | src/catch2/internal/catch_reporter_spec_parser.cpp | 19 | ||||
| -rw-r--r-- | src/catch2/internal/catch_reporter_spec_parser.hpp | 5 |
2 files changed, 23 insertions, 1 deletions
diff --git a/src/catch2/internal/catch_reporter_spec_parser.cpp b/src/catch2/internal/catch_reporter_spec_parser.cpp index 28e3c19b..9f896ae2 100644 --- a/src/catch2/internal/catch_reporter_spec_parser.cpp +++ b/src/catch2/internal/catch_reporter_spec_parser.cpp @@ -8,6 +8,8 @@ #include <catch2/internal/catch_reporter_spec_parser.hpp> +#include <catch2/interfaces/catch_interfaces_config.hpp> + namespace Catch { namespace Detail { @@ -59,6 +61,21 @@ namespace Catch { return parts; } - } + + Optional<ColourMode> stringToColourMode( StringRef colourMode ) { + if ( colourMode == "default" ) { + return ColourMode::PlatformDefault; + } else if ( colourMode == "ansi" ) { + return ColourMode::ANSI; + } else if ( colourMode == "win32" ) { + return ColourMode::Win32; + } else if ( colourMode == "none" ) { + return ColourMode::None; + } else { + return {}; + } + } + } // namespace Detail + } // namespace Catch diff --git a/src/catch2/internal/catch_reporter_spec_parser.hpp b/src/catch2/internal/catch_reporter_spec_parser.hpp index 74632f25..3dd9f17e 100644 --- a/src/catch2/internal/catch_reporter_spec_parser.hpp +++ b/src/catch2/internal/catch_reporter_spec_parser.hpp @@ -8,6 +8,7 @@ #ifndef CATCH_REPORTER_SPEC_PARSER_HPP_INCLUDED #define CATCH_REPORTER_SPEC_PARSER_HPP_INCLUDED +#include <catch2/internal/catch_optional.hpp> #include <catch2/internal/catch_stringref.hpp> #include <vector> @@ -15,9 +16,13 @@ namespace Catch { + enum class ColourMode : std::uint8_t; + namespace Detail { //! Splits the reporter spec into reporter name and kv-pair options std::vector<std::string> splitReporterSpec( StringRef reporterSpec ); + + Optional<ColourMode> stringToColourMode( StringRef colourMode ); } } |