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

Don't indent stdout/ stderr in JUnit reporter

Commit
37f3820747eb7fd4e1d937e100de6f5fafcdb83c
Author
Phil Nash ·
Parents
28463671094a

Files · Download .tar.gz

Changes

 include/internal/catch_xmlwriter.hpp       | 8 ++++----
 include/reporters/catch_reporter_junit.hpp | 8 ++++----
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/include/internal/catch_xmlwriter.hpp b/include/internal/catch_xmlwriter.hpp
index f929f601..98e827f4 100644
--- a/include/internal/catch_xmlwriter.hpp
+++ b/include/internal/catch_xmlwriter.hpp
@@ -34,8 +34,8 @@ namespace Catch {
                     m_writer->endElement();
             }
 
-            ScopedElement& writeText( const std::string& text ) {
-                m_writer->writeText( text );
+            ScopedElement& writeText( const std::string& text, bool indent = true ) {
+                m_writer->writeText( text, indent );
                 return *this;
             }
 
@@ -131,11 +131,11 @@ namespace Catch {
             return *this;
         }
         
-        XmlWriter& writeText( const std::string& text ) {
+        XmlWriter& writeText( const std::string& text, bool indent = true ) {
             if( !text.empty() ){
                 bool tagWasOpen = m_tagIsOpen;
                 ensureTagClosed();
-                if( tagWasOpen )
+                if( tagWasOpen && indent )
                     stream() << m_indent;
                 writeEncodedText( text );
                 m_needsNewline = true;
diff --git a/include/reporters/catch_reporter_junit.hpp b/include/reporters/catch_reporter_junit.hpp
index 39c6e92a..8fac30d1 100644
--- a/include/reporters/catch_reporter_junit.hpp
+++ b/include/reporters/catch_reporter_junit.hpp
@@ -187,8 +187,8 @@ namespace Catch {
                     OutputTestCases( xml, *it );
                 }
       
-                xml.scopedElement( "system-out" ).writeText( trim( m_stdOut.str() ) );                
-                xml.scopedElement( "system-err" ).writeText( trim( m_stdErr.str() ) );
+                xml.scopedElement( "system-out" ).writeText( trim( m_stdOut.str() ), false );
+                xml.scopedElement( "system-err" ).writeText( trim( m_stdErr.str() ), false );
             }
         }
         
@@ -206,10 +206,10 @@ namespace Catch {
 
                 std::string stdOut = trim( it->m_stdOut );
                 if( !stdOut.empty() )
-                    xml.scopedElement( "system-out" ).writeText( stdOut );
+                    xml.scopedElement( "system-out" ).writeText( stdOut, false );
                 std::string stdErr = trim( it->m_stdErr );
                 if( !stdErr.empty() )
-                    xml.scopedElement( "system-err" ).writeText( stdErr );
+                    xml.scopedElement( "system-err" ).writeText( stdErr, false );
             }
         }