| 13852 | } |
| 13853 | |
| 13854 | void JunitReporter::writeSection( std::string const& className, |
| 13855 | std::string const& rootName, |
| 13856 | SectionNode const& sectionNode ) { |
| 13857 | std::string name = trim( sectionNode.stats.sectionInfo.name ); |
| 13858 | if( !rootName.empty() ) |
| 13859 | name = rootName + '/' + name; |
| 13860 | |
| 13861 | if( !sectionNode.assertions.empty() || |
| 13862 | !sectionNode.stdOut.empty() || |
| 13863 | !sectionNode.stdErr.empty() ) { |
| 13864 | XmlWriter::ScopedElement e = xml.scopedElement( "testcase" ); |
| 13865 | if( className.empty() ) { |
| 13866 | xml.writeAttribute( "classname", name ); |
| 13867 | xml.writeAttribute( "name", "root" ); |
| 13868 | } |
| 13869 | else { |
| 13870 | xml.writeAttribute( "classname", className ); |
| 13871 | xml.writeAttribute( "name", name ); |
| 13872 | } |
| 13873 | xml.writeAttribute( "time", ::Catch::Detail::stringify( sectionNode.stats.durationInSeconds ) ); |
| 13874 | |
| 13875 | writeAssertions( sectionNode ); |
| 13876 | |
| 13877 | if( !sectionNode.stdOut.empty() ) |
| 13878 | xml.scopedElement( "system-out" ).writeText( trim( sectionNode.stdOut ), false ); |
| 13879 | if( !sectionNode.stdErr.empty() ) |
| 13880 | xml.scopedElement( "system-err" ).writeText( trim( sectionNode.stdErr ), false ); |
| 13881 | } |
| 13882 | for( auto const& childNode : sectionNode.childSections ) |
| 13883 | if( className.empty() ) |
| 13884 | writeSection( name, "", *childNode ); |
| 13885 | else |
| 13886 | writeSection( className, name, *childNode ); |
| 13887 | } |
| 13888 | |
| 13889 | void JunitReporter::writeAssertions( SectionNode const& sectionNode ) { |
| 13890 | for( auto const& assertion : sectionNode.assertions ) |
nothing calls this directly
no test coverage detected