| 16114 | } |
| 16115 | |
| 16116 | void JunitReporter::writeSection( std::string const& className, |
| 16117 | std::string const& rootName, |
| 16118 | SectionNode const& sectionNode ) { |
| 16119 | std::string name = trim( sectionNode.stats.sectionInfo.name ); |
| 16120 | if( !rootName.empty() ) |
| 16121 | name = rootName + '/' + name; |
| 16122 | |
| 16123 | if( !sectionNode.assertions.empty() || |
| 16124 | !sectionNode.stdOut.empty() || |
| 16125 | !sectionNode.stdErr.empty() ) { |
| 16126 | XmlWriter::ScopedElement e = xml.scopedElement( "testcase" ); |
| 16127 | if( className.empty() ) { |
| 16128 | xml.writeAttribute( "classname", name ); |
| 16129 | xml.writeAttribute( "name", "root" ); |
| 16130 | } |
| 16131 | else { |
| 16132 | xml.writeAttribute( "classname", className ); |
| 16133 | xml.writeAttribute( "name", name ); |
| 16134 | } |
| 16135 | xml.writeAttribute( "time", ::Catch::Detail::stringify( sectionNode.stats.durationInSeconds ) ); |
| 16136 | |
| 16137 | writeAssertions( sectionNode ); |
| 16138 | |
| 16139 | if( !sectionNode.stdOut.empty() ) |
| 16140 | xml.scopedElement( "system-out" ).writeText( trim( sectionNode.stdOut ), false ); |
| 16141 | if( !sectionNode.stdErr.empty() ) |
| 16142 | xml.scopedElement( "system-err" ).writeText( trim( sectionNode.stdErr ), false ); |
| 16143 | } |
| 16144 | for( auto const& childNode : sectionNode.childSections ) |
| 16145 | if( className.empty() ) |
| 16146 | writeSection( name, "", *childNode ); |
| 16147 | else |
| 16148 | writeSection( className, name, *childNode ); |
| 16149 | } |
| 16150 | |
| 16151 | void JunitReporter::writeAssertions( SectionNode const& sectionNode ) { |
| 16152 | for( auto const& assertion : sectionNode.assertions ) |
nothing calls this directly
no test coverage detected