| 14157 | } |
| 14158 | |
| 14159 | void JunitReporter::writeSection( std::string const& className, |
| 14160 | std::string const& rootName, |
| 14161 | SectionNode const& sectionNode ) { |
| 14162 | std::string name = trim( sectionNode.stats.sectionInfo.name ); |
| 14163 | if( !rootName.empty() ) |
| 14164 | name = rootName + '/' + name; |
| 14165 | |
| 14166 | if( !sectionNode.assertions.empty() || |
| 14167 | !sectionNode.stdOut.empty() || |
| 14168 | !sectionNode.stdErr.empty() ) { |
| 14169 | XmlWriter::ScopedElement e = xml.scopedElement( "testcase" ); |
| 14170 | if( className.empty() ) { |
| 14171 | xml.writeAttribute( "classname", name ); |
| 14172 | xml.writeAttribute( "name", "root" ); |
| 14173 | } |
| 14174 | else { |
| 14175 | xml.writeAttribute( "classname", className ); |
| 14176 | xml.writeAttribute( "name", name ); |
| 14177 | } |
| 14178 | xml.writeAttribute( "time", ::Catch::Detail::stringify( sectionNode.stats.durationInSeconds ) ); |
| 14179 | |
| 14180 | writeAssertions( sectionNode ); |
| 14181 | |
| 14182 | if( !sectionNode.stdOut.empty() ) |
| 14183 | xml.scopedElement( "system-out" ).writeText( trim( sectionNode.stdOut ), false ); |
| 14184 | if( !sectionNode.stdErr.empty() ) |
| 14185 | xml.scopedElement( "system-err" ).writeText( trim( sectionNode.stdErr ), false ); |
| 14186 | } |
| 14187 | for( auto const& childNode : sectionNode.childSections ) |
| 14188 | if( className.empty() ) |
| 14189 | writeSection( name, "", *childNode ); |
| 14190 | else |
| 14191 | writeSection( className, name, *childNode ); |
| 14192 | } |
| 14193 | |
| 14194 | void JunitReporter::writeAssertions( SectionNode const& sectionNode ) { |
| 14195 | for( auto const& assertion : sectionNode.assertions ) |
nothing calls this directly
no test coverage detected