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

Some test case header refactoring

Commit
0a87795535f73d8a5c4ebbe1db220d7775245592
Author
Phil Nash ·
Parents
5a60ce211746

Files · Download .tar.gz

Changes

 include/reporters/catch_reporter_console.hpp | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/include/reporters/catch_reporter_console.hpp b/include/reporters/catch_reporter_console.hpp
index 48b843c2..17292c9e 100644
--- a/include/reporters/catch_reporter_console.hpp
+++ b/include/reporters/catch_reporter_console.hpp
@@ -244,9 +244,8 @@ namespace Catch {
         }
         void lazyPrintTestCaseInfo() {
             if( !currentSectionInfo ) {
-                stream  << getDashes() << "\n"
-                        << "Test case" << ": '" << unusedTestCaseInfo->name << "'\n";                            
-                stream << getDashes() << "\n" << std::endl;
+                printTestCaseHeader();
+                stream << std::endl;
                 unusedTestCaseInfo.reset();
             }
         }
@@ -260,9 +259,7 @@ namespace Catch {
             
             // Sections
             if( !sections.empty() ) {
-                stream  << getDashes() << "\n"
-                        << "Test case" << ": '" << unusedTestCaseInfo->name << "'\n"
-                        << getDashes() << "\n";
+                printTestCaseHeader();
                 
                 std::string firstInset;
                 std::string inset;
@@ -286,12 +283,16 @@ namespace Catch {
                 unusedSectionInfo.reset();
             }
         }
-        
+
+        void printTestCaseHeader() {
+            printHeader( "Test case", unusedTestCaseInfo->name );
+        }
         void printHeader( std::string const& _type, std::string const& _name ) {
             stream  << getDashes() << "\n"
                     << _type << ": '" << _name << "'\n"
-                    << getDashes() << std::endl;
+                    << getDashes() << "\n";
         }
+        
         void printTotals( const Totals& totals ) {
             if( totals.assertions.total() == 0 ) {
                 stream << "No tests ran";