mirror of
https://github.com/catchorg/Catch2.git
synced 2025-08-01 12:55:40 +02:00
First cut of Timer class.
- started integrating with reporters (now (optionally) supported in console reporter). - introduced Node<> template to help with cumulative reporting and used it instead of ThreadedSectionInfo.
This commit is contained in:
@@ -69,6 +69,8 @@ namespace Catch {
|
||||
stream << " '" << _sectionStats.sectionInfo.name << "'\n" << std::endl;
|
||||
}
|
||||
m_headerPrinted = false;
|
||||
if( m_config->showDurations() == ShowDurations::Always )
|
||||
stream << "Completed in " << _sectionStats.durationInSeconds << "s" << std::endl;
|
||||
StreamingReporterBase::sectionEnded( _sectionStats );
|
||||
}
|
||||
|
||||
@@ -263,20 +265,20 @@ namespace Catch {
|
||||
assert( currentSectionInfo );
|
||||
if( currentSectionInfo ) {
|
||||
Colour colourGuard( Colour::Headers );
|
||||
std::vector<ThreadedSectionInfo*> sections;
|
||||
for( ThreadedSectionInfo* section = currentSectionInfo.get();
|
||||
std::vector<Node<SectionInfo>*> sections;
|
||||
for( Node<SectionInfo>* section = currentSectionInfo.get();
|
||||
section;
|
||||
section = section->parent )
|
||||
sections.push_back( section );
|
||||
|
||||
// Sections
|
||||
std::vector<ThreadedSectionInfo*>::const_reverse_iterator
|
||||
std::vector<Node<SectionInfo>*>::const_reverse_iterator
|
||||
it = sections.rbegin(), itEnd = sections.rend();
|
||||
for( ++it; it != itEnd; ++it ) // Skip first section (test case)
|
||||
printHeaderString( (*it)->name, 2 );
|
||||
printHeaderString( (*it)->value.name, 2 );
|
||||
}
|
||||
SourceLineInfo lineInfo = currentSectionInfo
|
||||
? currentSectionInfo->lineInfo
|
||||
? currentSectionInfo->value.lineInfo
|
||||
: unusedTestCaseInfo->lineInfo;
|
||||
|
||||
if( !lineInfo.empty() ){
|
||||
|
@@ -82,7 +82,7 @@ namespace Catch {
|
||||
return true;
|
||||
}
|
||||
|
||||
virtual void StartTesting(){}
|
||||
virtual void StartTesting() {}
|
||||
|
||||
virtual void StartGroup( const std::string& groupName ) {
|
||||
if( groupName.empty() )
|
||||
@@ -189,7 +189,10 @@ namespace Catch {
|
||||
xml.writeAttribute( "failures", it->m_failuresCount );
|
||||
xml.writeAttribute( "tests", it->m_testsCount );
|
||||
xml.writeAttribute( "hostname", "tbd" );
|
||||
xml.writeAttribute( "time", "tbd" );
|
||||
if( m_config.fullConfig()->showDurations() == ShowDurations::Never )
|
||||
xml.writeAttribute( "time", it->m_timeInSeconds );
|
||||
else
|
||||
xml.writeAttribute( "time", "" );
|
||||
xml.writeAttribute( "timestamp", "tbd" );
|
||||
|
||||
OutputTestCases( xml, *it );
|
||||
@@ -207,7 +210,10 @@ namespace Catch {
|
||||
XmlWriter::ScopedElement e = xml.scopedElement( "testcase" );
|
||||
xml.writeAttribute( "classname", it->m_className );
|
||||
xml.writeAttribute( "name", it->m_name );
|
||||
xml.writeAttribute( "time", "tbd" );
|
||||
if( m_config.fullConfig()->showDurations() == ShowDurations::Never )
|
||||
xml.writeAttribute( "time", "" );
|
||||
else
|
||||
xml.writeAttribute( "time", stats.m_timeInSeconds );
|
||||
|
||||
OutputTestResult( xml, *it );
|
||||
|
||||
|
Reference in New Issue
Block a user