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

Green summary bar is darker if not all passed

- and the green part now comes at the end (to emphasise the failures)
Commit
cab9141eec0c0f155e1d26e25b900fcaa4827c24
Author
Phil Nash ·
Parents
d89e74faff15

Files · Download .tar.gz

Changes

 include/internal/catch_totals.hpp            | 3 +++
 include/reporters/catch_reporter_console.hpp | 5 ++++-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/include/internal/catch_totals.hpp b/include/internal/catch_totals.hpp
index e289a0f0..75386ae8 100644
--- a/include/internal/catch_totals.hpp
+++ b/include/internal/catch_totals.hpp
@@ -32,6 +32,9 @@ namespace Catch {
         std::size_t total() const {
             return passed + failed + failedButOk;
         }
+        bool allPassed() const {
+            return failed == 0 && failedButOk == 0;
+        }
 
         std::size_t passed;
         std::size_t failed;
diff --git a/include/reporters/catch_reporter_console.hpp b/include/reporters/catch_reporter_console.hpp
index f9373598..84904cb0 100644
--- a/include/reporters/catch_reporter_console.hpp
+++ b/include/reporters/catch_reporter_console.hpp
@@ -388,9 +388,12 @@ namespace Catch {
                 while( failedRatio + failedButOkRatio + passedRatio > CATCH_CONFIG_CONSOLE_WIDTH-1 )
                     findMax( failedRatio, failedButOkRatio, passedRatio )--;
 
-                stream << Colour( Colour::ResultSuccess ) << std::string( passedRatio, '=' );
                 stream << Colour( Colour::Error ) << std::string( failedRatio, '=' );
                 stream << Colour( Colour::ResultExpectedFailure ) << std::string( failedButOkRatio, '=' );
+                if( totals.testCases.allPassed() )
+                    stream << Colour( Colour::ResultSuccess ) << std::string( passedRatio, '=' );
+                else
+                    stream << Colour( Colour::Success ) << std::string( passedRatio, '=' );
             }
             else {
                 stream << Colour( Colour::Warning ) << std::string( CATCH_CONFIG_CONSOLE_WIDTH-1, '=' );