| 16614 | } |
| 16615 | |
| 16616 | void JunitReporter::writeSection( std::string const& className, |
| 16617 | std::string const& rootName, |
| 16618 | SectionNode const& sectionNode ) { |
| 16619 | std::string name = trim( sectionNode.stats.sectionInfo.name ); |
| 16620 | if( !rootName.empty() ) |
| 16621 | name = rootName + '/' + name; |
| 16622 | |
| 16623 | if( !sectionNode.assertions.empty() || |
| 16624 | !sectionNode.stdOut.empty() || |
| 16625 | !sectionNode.stdErr.empty() ) { |
| 16626 | XmlWriter::ScopedElement e = xml.scopedElement( "testcase" ); |
| 16627 | if( className.empty() ) { |
| 16628 | xml.writeAttribute( "classname", name ); |
| 16629 | xml.writeAttribute( "name", "root" ); |
| 16630 | } |
| 16631 | else { |
| 16632 | xml.writeAttribute( "classname", className ); |
| 16633 | xml.writeAttribute( "name", name ); |
| 16634 | } |
| 16635 | xml.writeAttribute( "time", ::Catch::Detail::stringify( sectionNode.stats.durationInSeconds ) ); |
| 16636 | |
| 16637 | writeAssertions( sectionNode ); |
| 16638 | |
| 16639 | if( !sectionNode.stdOut.empty() ) |
| 16640 | xml.scopedElement( "system-out" ).writeText( trim( sectionNode.stdOut ), XmlFormatting::Newline ); |
| 16641 | if( !sectionNode.stdErr.empty() ) |
| 16642 | xml.scopedElement( "system-err" ).writeText( trim( sectionNode.stdErr ), XmlFormatting::Newline ); |
| 16643 | } |
| 16644 | for( auto const& childNode : sectionNode.childSections ) |
| 16645 | if( className.empty() ) |
| 16646 | writeSection( name, "", *childNode ); |
| 16647 | else |
| 16648 | writeSection( className, name, *childNode ); |
| 16649 | } |
| 16650 | |
| 16651 | void JunitReporter::writeAssertions( SectionNode const& sectionNode ) { |
| 16652 | for( auto const& assertion : sectionNode.assertions ) |
nothing calls this directly
no test coverage detected