MCPcopy Create free account
hub / github.com/InteractiveComputerGraphics/SPlisHSPlasH / writeSection

Method writeSection

extern/Catch2/catch.hpp:16972–17016  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

16970 }
16971
16972 void JunitReporter::writeSection( std::string const& className,
16973 std::string const& rootName,
16974 SectionNode const& sectionNode,
16975 bool testOkToFail) {
16976 std::string name = trim( sectionNode.stats.sectionInfo.name );
16977 if( !rootName.empty() )
16978 name = rootName + '/' + name;
16979
16980 if( !sectionNode.assertions.empty() ||
16981 !sectionNode.stdOut.empty() ||
16982 !sectionNode.stdErr.empty() ) {
16983 XmlWriter::ScopedElement e = xml.scopedElement( "testcase" );
16984 if( className.empty() ) {
16985 xml.writeAttribute( "classname", name );
16986 xml.writeAttribute( "name", "root" );
16987 }
16988 else {
16989 xml.writeAttribute( "classname", className );
16990 xml.writeAttribute( "name", name );
16991 }
16992 xml.writeAttribute( "time", formatDuration( sectionNode.stats.durationInSeconds ) );
16993 // This is not ideal, but it should be enough to mimic gtest's
16994 // junit output.
16995 // Ideally the JUnit reporter would also handle `skipTest`
16996 // events and write those out appropriately.
16997 xml.writeAttribute( "status", "run" );
16998
16999 if (sectionNode.stats.assertions.failedButOk) {
17000 xml.scopedElement("skipped")
17001 .writeAttribute("message", "TEST_CASE tagged with !mayfail");
17002 }
17003
17004 writeAssertions( sectionNode );
17005
17006 if( !sectionNode.stdOut.empty() )
17007 xml.scopedElement( "system-out" ).writeText( trim( sectionNode.stdOut ), XmlFormatting::Newline );
17008 if( !sectionNode.stdErr.empty() )
17009 xml.scopedElement( "system-err" ).writeText( trim( sectionNode.stdErr ), XmlFormatting::Newline );
17010 }
17011 for( auto const& childNode : sectionNode.childSections )
17012 if( className.empty() )
17013 writeSection( name, "", *childNode, testOkToFail );
17014 else
17015 writeSection( className, name, *childNode, testOkToFail );
17016 }
17017
17018 void JunitReporter::writeAssertions( SectionNode const& sectionNode ) {
17019 for( auto const& assertion : sectionNode.assertions )

Callers

nothing calls this directly

Calls 4

trimFunction · 0.85
formatDurationFunction · 0.85
scopedElementMethod · 0.80
emptyMethod · 0.45

Tested by

no test coverage detected