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 section headers

- and don't reprint test case name
Commit
2771220a41ebe52efc94be80ee5f391324e9adea
Author
Phil Nash ·
Parents
8ec959e936a9

Files · Download .tar.gz

Changes

 include/reporters/catch_reporter_teamcity.hpp | 25 ++++++++++---------------
 1 file changed, 10 insertions(+), 15 deletions(-)

diff --git a/include/reporters/catch_reporter_teamcity.hpp b/include/reporters/catch_reporter_teamcity.hpp
index 47eafb19..ffb9bf5c 100644
--- a/include/reporters/catch_reporter_teamcity.hpp
+++ b/include/reporters/catch_reporter_teamcity.hpp
@@ -68,9 +68,11 @@ namespace Catch {
                 
                 std::ostringstream msg;
                 if( !m_headerPrintedForThisSection )
-                    printTestCaseAndSectionHeader( msg );
+                    printSectionHeader( msg );
                 m_headerPrintedForThisSection = true;
                 
+                msg << result.getSourceInfo() << "\n";
+                
                 switch( result.getResultType() ) {
                     case ResultWas::ExpressionFailed:
                         msg << "expression failed";
@@ -117,8 +119,6 @@ namespace Catch {
                         "with expansion:\n" <<
                         "  " << result.getExpandedExpression() << "\n";
                 }
-                msg << "\n" << result.getSourceInfo() << "\n";
-                msg << "---------------------------------------";
                 
                 stream << "##teamcity[testFailed"
                     << " name='" << escape( currentTestCaseInfo->name )<< "'"
@@ -159,32 +159,27 @@ namespace Catch {
 //        }
         
     private:
-        void printTestCaseAndSectionHeader( std::ostream& os ) {
+        void printSectionHeader( std::ostream& os ) {
             assert( !m_sectionStack.empty() );
-            printOpenHeader( os, currentTestCaseInfo->name );
-            
+
             if( m_sectionStack.size() > 1 ) {
+                os << getLineOfChars<'-'>() << "\n";
+
                 std::vector<SectionInfo>::const_iterator
                 it = m_sectionStack.begin()+1, // Skip first section (test case)
                 itEnd = m_sectionStack.end();
                 for( ; it != itEnd; ++it )
-                    printHeaderString( os, it->name, 2 );
+                    printHeaderString( os, it->name );
+                os << getLineOfChars<'-'>() << "\n";
             }
             
             SourceLineInfo lineInfo = m_sectionStack.front().lineInfo;
             
-            if( !lineInfo.empty() ){
-                os << getLineOfChars<'-'>() << "\n";
+            if( !lineInfo.empty() )
                 os << lineInfo << "\n";
-            }
             os << getLineOfChars<'.'>() << "\n\n";
         }
 
-        void printOpenHeader( std::ostream& os, std::string const& _name ) {
-            os  << getLineOfChars<'-'>() << "\n";
-            printHeaderString( os, _name );
-        }
-
         // if string has a : in first line will set indent to follow it on
         // subsequent lines
         void printHeaderString( std::ostream& os, std::string const& _string, std::size_t indent = 0 ) {