diff --git a/include/internal/catch_xmlwriter.hpp b/include/internal/catch_xmlwriter.hpp index e29b1b41..ae59627c 100644 --- a/include/internal/catch_xmlwriter.hpp +++ b/include/internal/catch_xmlwriter.hpp @@ -211,6 +211,13 @@ namespace Catch { return *this; } + void ensureTagClosed() { + if( m_tagIsOpen ) { + m_os << ">" << std::endl; + m_tagIsOpen = false; + } + } + private: XmlWriter( XmlWriter const& ); void operator=( XmlWriter const& ); @@ -219,13 +226,6 @@ namespace Catch { m_os << "\n"; } - void ensureTagClosed() { - if( m_tagIsOpen ) { - m_os << ">" << std::endl; - m_tagIsOpen = false; - } - } - void newlineIfNecessary() { if( m_needsNewline ) { m_os << std::endl; diff --git a/include/reporters/catch_reporter_xml.hpp b/include/reporters/catch_reporter_xml.hpp index 00baff93..d0a6689d 100644 --- a/include/reporters/catch_reporter_xml.hpp +++ b/include/reporters/catch_reporter_xml.hpp @@ -67,6 +67,7 @@ namespace Catch { if ( m_config->showDurations() == ShowDurations::Always ) m_testCaseTimer.start(); + m_xml.ensureTagClosed(); } virtual void sectionStarting( SectionInfo const& sectionInfo ) CATCH_OVERRIDE { @@ -75,6 +76,7 @@ namespace Catch { m_xml.startElement( "Section" ) .writeAttribute( "name", trim( sectionInfo.name ) ) .writeAttribute( "description", sectionInfo.description ); + m_xml.ensureTagClosed(); } } diff --git a/projects/SelfTest/Baselines/console.std.approved.txt b/projects/SelfTest/Baselines/console.std.approved.txt index 42b01d02..bec5712c 100644 --- a/projects/SelfTest/Baselines/console.std.approved.txt +++ b/projects/SelfTest/Baselines/console.std.approved.txt @@ -711,7 +711,7 @@ MiscTests.cpp:: FAILED: with expansion: false -------------------------------------------------------------------------------- +spanner------------------------------------------------------------------------------- just failure ------------------------------------------------------------------------------- MessageTests.cpp: @@ -829,6 +829,6 @@ with expansion: "first" == "second" =============================================================================== -test cases: 160 | 116 passed | 42 failed | 2 failed as expected +test cases: 161 | 117 passed | 42 failed | 2 failed as expected assertions: 932 | 836 passed | 78 failed | 18 failed as expected diff --git a/projects/SelfTest/Baselines/console.sw.approved.txt b/projects/SelfTest/Baselines/console.sw.approved.txt index d48a03ff..4a4d9a38 100644 --- a/projects/SelfTest/Baselines/console.sw.approved.txt +++ b/projects/SelfTest/Baselines/console.sw.approved.txt @@ -8329,7 +8329,7 @@ MiscTests.cpp: MiscTests.cpp:: PASSED: -------------------------------------------------------------------------------- +spanner------------------------------------------------------------------------------- just failure ------------------------------------------------------------------------------- MessageTests.cpp: @@ -9164,6 +9164,6 @@ MiscTests.cpp:: PASSED: =============================================================================== -test cases: 160 | 115 passed | 43 failed | 2 failed as expected +test cases: 161 | 116 passed | 43 failed | 2 failed as expected assertions: 934 | 836 passed | 80 failed | 18 failed as expected diff --git a/projects/SelfTest/Baselines/junit.sw.approved.txt b/projects/SelfTest/Baselines/junit.sw.approved.txt index ad92d78a..4a1cb048 100644 --- a/projects/SelfTest/Baselines/junit.sw.approved.txt +++ b/projects/SelfTest/Baselines/junit.sw.approved.txt @@ -1,5 +1,5 @@ - + diff --git a/projects/SelfTest/Baselines/xml.sw.approved.txt b/projects/SelfTest/Baselines/xml.sw.approved.txt index c4a78b79..cfa7b1c5 100644 --- a/projects/SelfTest/Baselines/xml.sw.approved.txt +++ b/projects/SelfTest/Baselines/xml.sw.approved.txt @@ -8845,6 +8845,9 @@ there" + +spanner + Previous info should not be seen diff --git a/projects/SelfTest/TrickyTests.cpp b/projects/SelfTest/TrickyTests.cpp index 90a4f2fa..f0311158 100644 --- a/projects/SelfTest/TrickyTests.cpp +++ b/projects/SelfTest/TrickyTests.cpp @@ -399,3 +399,9 @@ TEST_CASE( "X/level/0/a", "[Tricky]" ) { SUCCEED(""); } TEST_CASE( "X/level/0/b", "[Tricky][fizz]" ){ SUCCEED(""); } TEST_CASE( "X/level/1/a", "[Tricky]" ) { SUCCEED(""); } TEST_CASE( "X/level/1/b", "[Tricky]" ) { SUCCEED(""); } + +TEST_CASE( "has printf", "" ) { + + // This can cause problems as, currently, stdout itself is not redirect - only the cout (and cerr) buffer + printf( "spanner" ); +}