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

Use SecondaryText code in lists

Commit
2a17ef908112577c03011c6da36db7ced473148d
Author
Phil Nash ·
Parents
c7e602f3f211

Files · Download .tar.gz

Changes

 include/internal/catch_console_colour_impl.hpp |  1 +
 include/internal/catch_list.hpp                | 39 +++++++++++++++++++-------
 include/reporters/catch_reporter_console.hpp   |  1 +
 3 files changed, 31 insertions(+), 10 deletions(-)

diff --git a/include/internal/catch_console_colour_impl.hpp b/include/internal/catch_console_colour_impl.hpp
index 2a1e677c..939b0097 100644
--- a/include/internal/catch_console_colour_impl.hpp
+++ b/include/internal/catch_console_colour_impl.hpp
@@ -90,6 +90,7 @@ namespace {
     const char* Cyan =          "[0;36m";
     const char* Yellow =        "[0;33m";
     const char* LightGrey =     "[0;37m";
+//    const char* DarkGrey =      "[1;30m";
 
     struct AnsiConsoleColourCodes : IConsoleColourCodes {
     
diff --git a/include/internal/catch_list.hpp b/include/internal/catch_list.hpp
index 458c3a21..762447f3 100644
--- a/include/internal/catch_list.hpp
+++ b/include/internal/catch_list.hpp
@@ -10,6 +10,7 @@
 
 #include "catch_commandline.hpp"
 #include "catch_line_wrap.h"
+#include "catch_console_colour.hpp"
 
 #include <limits>
 #include <algorithm>
@@ -63,17 +64,31 @@ namespace Catch {
                 tagsWrapper.setRight( maxTagLen ).wrap( it->getTestCaseInfo().tagsAsString );
                 
                 for( std::size_t i = 0; i < std::max( nameWrapper.size(), tagsWrapper.size() ); ++i ) {
+                    TextColour::Colours colour = TextColour::None;
+                    if( it->getTestCaseInfo().isHidden )
+                        colour = TextColour::SecondaryText;
                     std::string nameCol;
-                    if( i < nameWrapper.size() )
+                    if( i < nameWrapper.size() ) {
                         nameCol = nameWrapper[i];
-                    else
+                    }
+                    else {
                         nameCol = "    ...";
-                    std::cout << nameCol;
+                        colour = TextColour::SecondaryText;
+                    }
+                    
+                    {
+                        TextColour colourGuard( colour );
+                        std::cout << nameCol;
+                    }
                     if( i < tagsWrapper.size() && !tagsWrapper[i].empty() ) {
-                        if( i == 0 )
-                            std::cout << "  " << std::string( maxNameLen - nameCol.size(), '.' ) << "  " << tagsWrapper[i];
-                        else
-                            std::cout << std::string( maxNameLen - nameCol.size(), ' ' ) << "    " << tagsWrapper[i];
+                        if( i == 0 ) {
+                            TextColour colourGuard( TextColour::SecondaryText );
+                            std::cout << "  " << std::string( maxNameLen - nameCol.size(), '.' ) << "  ";
+                        }
+                        else {
+                            std::cout << std::string( maxNameLen - nameCol.size(), ' ' ) << "    ";
+                        }
+                        std::cout << tagsWrapper[i];
                     }
                     std::cout << "\n";
                 }
@@ -124,10 +139,14 @@ namespace Catch {
             wrapper.setIndent(2).setRight( maxTagLen ).wrap( countIt->first );
             
             std::cout << wrapper;
+            std::size_t dots = 2;
             if( maxTagLen > wrapper.last().size() )
-            std::cout << std::string( maxTagLen - wrapper.last().size(), '.' );
-            std::cout   << ".. "
-                        << countIt->second
+                dots += maxTagLen - wrapper.last().size();
+            {
+                TextColour colourGuard( TextColour::SecondaryText );
+                std::cout << std::string( dots, '.' );
+            }
+            std::cout   << countIt->second
                         << "\n";
         }
         std::cout << pluralise( tagCounts.size(), "tag" ) << std::endl;
diff --git a/include/reporters/catch_reporter_console.hpp b/include/reporters/catch_reporter_console.hpp
index b5ce9ee2..0be6b6c3 100644
--- a/include/reporters/catch_reporter_console.hpp
+++ b/include/reporters/catch_reporter_console.hpp
@@ -253,6 +253,7 @@ namespace Catch {
         }
         void lazyPrintRunInfo() {
             stream  << "\n" << getTildes() << "\n";
+            TextColour colour( TextColour::SecondaryText );
             stream  << testRunInfo->name
                     << " is a CATCH v"  << libraryVersion.majorVersion << "."
                     << libraryVersion.minorVersion << " b"