Progmasoft Git

catch3

Progmasoft Catch3: an independently maintained C++17 test framework with a parallel runner, property checks, snapshots and structured results.

Clonegit clone https://git.progmasoft.com/catch3

Make default colour selection fall-through

Closes #2426
Commit
2dc657cd1f9ce9f67b93a6511acea2775965e621
Author
Martin Hořeňovský ·
Parents
cca59235023f

Files · Download .tar.gz

Changes

 src/catch2/internal/catch_console_colour.cpp | 17 +++++++----------
 1 file changed, 7 insertions(+), 10 deletions(-)

diff --git a/src/catch2/internal/catch_console_colour.cpp b/src/catch2/internal/catch_console_colour.cpp
index 698fb0be..c77e8295 100644
--- a/src/catch2/internal/catch_console_colour.cpp
+++ b/src/catch2/internal/catch_console_colour.cpp
@@ -232,25 +232,22 @@ namespace Catch {
 
     Detail::unique_ptr<ColourImpl> makeColourImpl( ColourMode implSelection,
                                                    IStream* stream ) {
-        if ( implSelection == ColourMode::None ) {
-            return Detail::make_unique<NoColourImpl>( stream );
-        }
-        if ( implSelection == ColourMode::ANSI ) {
-            return Detail::make_unique<ANSIColourImpl>( stream );
-        }
 #if defined( CATCH_CONFIG_COLOUR_WIN32 )
         if ( implSelection == ColourMode::Win32 ) {
             return Detail::make_unique<Win32ColourImpl>( stream );
         }
 #endif
+        if ( implSelection == ColourMode::ANSI ) {
+            return Detail::make_unique<ANSIColourImpl>( stream );
+        }
+        if ( implSelection == ColourMode::None ) {
+            return Detail::make_unique<NoColourImpl>( stream );
+        }
 
-        // todo: check win32 eligibility under ifdef, otherwise ansi
         if ( implSelection == ColourMode::PlatformDefault) {
-#if defined (CATCH_CONFIG_COLOUR_WIN32)
+#if defined( CATCH_CONFIG_COLOUR_WIN32 )
             if ( Win32ColourImpl::useImplementationForStream( *stream ) ) {
                 return Detail::make_unique<Win32ColourImpl>( stream );
-            } else {
-                return Detail::make_unique<NoColourImpl>( stream );
             }
 #endif
             if ( ANSIColourImpl::useImplementationForStream( *stream ) ) {