MCPcopy Create free account
hub / github.com/ChaiScript/ChaiScript / writeSection

Method writeSection

unittests/catch.hpp:12328–12361  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

12326 }
12327
12328 void JunitReporter::writeSection( std::string const& className,
12329 std::string const& rootName,
12330 SectionNode const& sectionNode ) {
12331 std::string name = trim( sectionNode.stats.sectionInfo.name );
12332 if( !rootName.empty() )
12333 name = rootName + '/' + name;
12334
12335 if( !sectionNode.assertions.empty() ||
12336 !sectionNode.stdOut.empty() ||
12337 !sectionNode.stdErr.empty() ) {
12338 XmlWriter::ScopedElement e = xml.scopedElement( "testcase" );
12339 if( className.empty() ) {
12340 xml.writeAttribute( "classname", name );
12341 xml.writeAttribute( "name", "root" );
12342 }
12343 else {
12344 xml.writeAttribute( "classname", className );
12345 xml.writeAttribute( "name", name );
12346 }
12347 xml.writeAttribute( "time", ::Catch::Detail::stringify( sectionNode.stats.durationInSeconds ) );
12348
12349 writeAssertions( sectionNode );
12350
12351 if( !sectionNode.stdOut.empty() )
12352 xml.scopedElement( "system-out" ).writeText( trim( sectionNode.stdOut ), false );
12353 if( !sectionNode.stdErr.empty() )
12354 xml.scopedElement( "system-err" ).writeText( trim( sectionNode.stdErr ), false );
12355 }
12356 for( auto const& childNode : sectionNode.childSections )
12357 if( className.empty() )
12358 writeSection( name, "", *childNode );
12359 else
12360 writeSection( className, name, *childNode );
12361 }
12362
12363 void JunitReporter::writeAssertions( SectionNode const& sectionNode ) {
12364 for( auto const& assertion : sectionNode.assertions )

Callers

nothing calls this directly

Calls 4

trimFunction · 0.85
stringifyFunction · 0.85
scopedElementMethod · 0.80
emptyMethod · 0.45

Tested by

no test coverage detected