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

Cleaned up summary reporting

Improved newlines and pluralisation
Commit
e1a2480f498149397b81b5ab12a8b13a206aa068
Author
Phil Nash ·
Parents
3619cb2f091a

Files · Download .tar.gz

Changes

 include/reporters/catch_reporter_basic.hpp | 27 +++++++++++++++++++++++----
 projects/SelfTest/MiscTests.cpp            |  4 ++--
 2 files changed, 25 insertions(+), 6 deletions(-)

diff --git a/include/reporters/catch_reporter_basic.hpp b/include/reporters/catch_reporter_basic.hpp
index 25b6be8e..facb51a8 100644
--- a/include/reporters/catch_reporter_basic.hpp
+++ b/include/reporters/catch_reporter_basic.hpp
@@ -70,11 +70,30 @@ namespace Catch
             if( failed + succeeded == 0 )
                 m_config.stream() << "No tests ran";
             else if( failed == 0 )
-                m_config.stream() << "All " << succeeded << " test(s) succeeded";
+            {
+                if( succeeded == 1 )
+                    m_config.stream() << "1 test succeeded";
+                else
+                    m_config.stream() << "All " << succeeded << " tests succeeded";
+            }
             else if( succeeded == 0 )
-                m_config.stream() << "All " << failed << " test(s) failed";
+            {
+                if( failed == 1 )                    
+                    m_config.stream() << "1 test failed";
+                else
+                    m_config.stream() << "All " << failed << " tests failed";
+            }
             else
-                m_config.stream() << succeeded << " test(s) passed but " << failed << " test(s) failed";
+            {
+                m_config.stream() << succeeded << " test";
+                if( succeeded > 1 )
+                    m_config.stream() << "s";
+
+                m_config.stream() << " passed but " << failed << " test";
+                if( failed > 1 )
+                    m_config.stream() << "s";
+                m_config.stream() << " failed";
+            }
         }
         
     private: // IReporter
@@ -102,7 +121,7 @@ namespace Catch
         )
         {
             // Output the overall test results even if "Started Testing" was not emitted
-            m_config.stream() << "[Testing completed. ";
+            m_config.stream() << "\n[Testing completed. ";
             ReportCounts( succeeded, failed );
             m_config.stream() << "]\n" << std::endl;
         }
diff --git a/projects/SelfTest/MiscTests.cpp b/projects/SelfTest/MiscTests.cpp
index e509b4a1..f73f742d 100644
--- a/projects/SelfTest/MiscTests.cpp
+++ b/projects/SelfTest/MiscTests.cpp
@@ -98,9 +98,9 @@ TEST_CASE( "./mixed/Misc/loops", "looped tests" )
 
 TEST_CASE( "./succeeding/Misc/stdout,stderr", "Sends stuff to stdout and stderr" )
 {
-    std::cout << "Some information";
+    std::cout << "Some information" << std::endl;
     
-    std::cerr << "An error";
+    std::cerr << "An error" << std::endl;
 }
 
 inline const char* makeString( bool makeNull )