Skip to content

Commit

Permalink
Cleanup xml reporter handling of tag ending
Browse files Browse the repository at this point in the history
  • Loading branch information
horenmar committed Dec 22, 2022
1 parent f68c5e9 commit 5691f74
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions src/catch2/reporters/catch_reporter_xml.cpp
Expand Up @@ -170,16 +170,18 @@ namespace Catch {

void XmlReporter::sectionEnded( SectionStats const& sectionStats ) {
StreamingReporterBase::sectionEnded( sectionStats );
if( --m_sectionDepth > 0 ) {
XmlWriter::ScopedElement e = m_xml.scopedElement( "OverallResults" );
e.writeAttribute( "successes"_sr, sectionStats.assertions.passed );
e.writeAttribute( "failures"_sr, sectionStats.assertions.failed );
e.writeAttribute( "expectedFailures"_sr, sectionStats.assertions.failedButOk );
e.writeAttribute( "skipped"_sr, sectionStats.assertions.skipped > 0 );

if ( m_config->showDurations() == ShowDurations::Always )
e.writeAttribute( "durationInSeconds"_sr, sectionStats.durationInSeconds );

if ( --m_sectionDepth > 0 ) {
{
XmlWriter::ScopedElement e = m_xml.scopedElement( "OverallResults" );
e.writeAttribute( "successes"_sr, sectionStats.assertions.passed );
e.writeAttribute( "failures"_sr, sectionStats.assertions.failed );
e.writeAttribute( "expectedFailures"_sr, sectionStats.assertions.failedButOk );
e.writeAttribute( "skipped"_sr, sectionStats.assertions.skipped > 0 );

if ( m_config->showDurations() == ShowDurations::Always )
e.writeAttribute( "durationInSeconds"_sr, sectionStats.durationInSeconds );
}
// Ends assertion tag
m_xml.endElement();
}
}
Expand Down

0 comments on commit 5691f74

Please sign in to comment.