mirror of
https://github.com/catchorg/Catch2.git
synced 2024-11-22 21:36:11 +01:00
Tightened up ReporterConfig and added it to LegacyReporterAdapter
This commit is contained in:
parent
f9d92634f5
commit
4b36001698
@ -45,7 +45,7 @@ namespace Catch {
|
||||
std::vector<TestCaseFilters>::const_iterator it = filterGroups.begin();
|
||||
std::vector<TestCaseFilters>::const_iterator itEnd = filterGroups.end();
|
||||
|
||||
LegacyReporterAdapter reporter( m_reporter );
|
||||
LegacyReporterAdapter reporter( m_reporter, ReporterConfig( m_configWrapper.stream(), m_config ) );
|
||||
|
||||
for(; it != itEnd && !context.aborting(); ++it ) {
|
||||
reporter.testGroupStarting( it->getName() );
|
||||
@ -100,7 +100,7 @@ namespace Catch {
|
||||
? "basic"
|
||||
: m_config.reporter;
|
||||
|
||||
ReporterConfig reporterConfig( m_config.name, m_configWrapper.stream(), m_config.includeWhichResults == Include::SuccessfulResults, m_config );
|
||||
ReporterConfig reporterConfig( m_configWrapper.stream(), m_config );
|
||||
|
||||
m_reporter = getRegistryHub().getReporterRegistry().create( reporterName, reporterConfig );
|
||||
if( !m_reporter ) {
|
||||
|
@ -23,31 +23,17 @@ namespace Catch
|
||||
{
|
||||
struct ReporterConfig
|
||||
{
|
||||
ReporterConfig( const std::string& _name,
|
||||
std::ostream& _stream,
|
||||
bool _includeSuccessfulResults,
|
||||
const ConfigData& _fullConfig )
|
||||
: name( _name ),
|
||||
stream( _stream ),
|
||||
includeSuccessfulResults( _includeSuccessfulResults ),
|
||||
fullConfig( _fullConfig )
|
||||
{}
|
||||
|
||||
ReporterConfig( const ReporterConfig& other )
|
||||
: name( other.name ),
|
||||
stream( other.stream ),
|
||||
includeSuccessfulResults( other.includeSuccessfulResults ),
|
||||
fullConfig( other.fullConfig )
|
||||
{}
|
||||
|
||||
ReporterConfig( std::ostream& _stream, const ConfigData& _fullConfig )
|
||||
: m_stream( &_stream ), m_fullConfig( _fullConfig ) {}
|
||||
|
||||
std::string name;
|
||||
std::ostream& stream;
|
||||
bool includeSuccessfulResults;
|
||||
ConfigData fullConfig;
|
||||
std::ostream& stream() { return *m_stream; }
|
||||
std::string name() const { return m_fullConfig.name; }
|
||||
bool includeSuccessfulResults() const { return m_fullConfig.includeWhichResults == Include::SuccessfulResults; }
|
||||
bool warnAboutMissingAssertions() const { return m_fullConfig.warnings & ConfigData::WarnAbout::NoAssertions; }
|
||||
|
||||
private:
|
||||
void operator=(const ReporterConfig&);
|
||||
std::ostream* m_stream;
|
||||
ConfigData m_fullConfig;
|
||||
};
|
||||
|
||||
struct AssertionStats {
|
||||
@ -67,11 +53,13 @@ namespace Catch
|
||||
const Totals& _totals,
|
||||
const std::string& _stdOut,
|
||||
const std::string& _stdErr,
|
||||
bool _missingAssertions,
|
||||
bool _aborting )
|
||||
: testInfo( _testInfo ),
|
||||
totals( _totals ),
|
||||
stdOut( _stdOut ),
|
||||
stdErr( _stdErr ),
|
||||
missingAssertions( _missingAssertions ),
|
||||
aborting( _aborting )
|
||||
{}
|
||||
|
||||
@ -79,6 +67,7 @@ namespace Catch
|
||||
Totals totals;
|
||||
std::string stdOut;
|
||||
std::string stdErr;
|
||||
bool missingAssertions;
|
||||
bool aborting;
|
||||
};
|
||||
|
||||
@ -166,8 +155,9 @@ namespace Catch
|
||||
class LegacyReporterAdapter : public SharedImpl<IStreamingReporter>
|
||||
{
|
||||
public:
|
||||
LegacyReporterAdapter( const Ptr<IReporter>& legacyReporter )
|
||||
: m_legacyReporter( legacyReporter )
|
||||
LegacyReporterAdapter( const Ptr<IReporter>& legacyReporter, const ReporterConfig& config )
|
||||
: m_legacyReporter( legacyReporter ),
|
||||
m_config( config )
|
||||
{}
|
||||
virtual ~LegacyReporterAdapter();
|
||||
|
||||
@ -189,6 +179,8 @@ namespace Catch
|
||||
m_legacyReporter->Result( assertionStats.assertionResult );
|
||||
}
|
||||
virtual void testCaseEnding( const TestCaseStats& testCaseStats ) {
|
||||
if( testCaseStats.missingAssertions )
|
||||
m_legacyReporter->NoAssertionsInTestCase( testCaseStats.testInfo.name );
|
||||
m_legacyReporter->EndTestCase( testCaseStats.testInfo, testCaseStats.totals, testCaseStats.stdOut, testCaseStats.stdErr );
|
||||
}
|
||||
virtual void testGroupEnding( const TestGroupStats& testGroupStats ) {
|
||||
@ -202,6 +194,7 @@ namespace Catch
|
||||
|
||||
private:
|
||||
Ptr<IReporter> m_legacyReporter;
|
||||
ReporterConfig m_config;
|
||||
};
|
||||
|
||||
|
||||
|
@ -68,11 +68,11 @@ namespace Catch {
|
||||
m_context.setRunner( this );
|
||||
m_context.setConfig( &m_config );
|
||||
m_context.setResultCapture( this );
|
||||
LegacyReporterAdapter( m_reporter ).testRunStarting( "" ); // !TBD - name
|
||||
LegacyReporterAdapter( m_reporter, ReporterConfig( m_config.stream(), m_config.data() ) ).testRunStarting( "" ); // !TBD - name
|
||||
}
|
||||
|
||||
virtual ~Runner() {
|
||||
LegacyReporterAdapter( m_reporter ).testRunEnding( TestRunStats( "", m_totals, aborting() ) ); // !TBD - name
|
||||
LegacyReporterAdapter( m_reporter, ReporterConfig( m_config.stream(), m_config.data() ) ).testRunEnding( TestRunStats( "", m_totals, aborting() ) ); // !TBD - name
|
||||
m_context.setRunner( m_prevRunner );
|
||||
m_context.setConfig( NULL );
|
||||
m_context.setResultCapture( m_prevResultCapture );
|
||||
@ -85,7 +85,7 @@ namespace Catch {
|
||||
|
||||
Totals totals;
|
||||
|
||||
LegacyReporterAdapter reporter( m_reporter );
|
||||
LegacyReporterAdapter reporter( m_reporter, ReporterConfig( m_config.stream(), m_config.data() ) );
|
||||
|
||||
reporter.testGroupStarting( testSpec );
|
||||
|
||||
@ -106,7 +106,7 @@ namespace Catch {
|
||||
|
||||
TestCaseInfo testInfo = testCase.getTestCaseInfo();
|
||||
|
||||
LegacyReporterAdapter reporter( m_reporter );
|
||||
LegacyReporterAdapter reporter( m_reporter, ReporterConfig( m_config.stream(), m_config.data() ) );
|
||||
reporter.testCaseStarting( testInfo );
|
||||
|
||||
m_runningTest = new RunningTest( &testCase );
|
||||
@ -120,15 +120,17 @@ namespace Catch {
|
||||
while( getCurrentContext().advanceGeneratorsForCurrentTest() && !aborting() );
|
||||
|
||||
Totals deltaTotals = m_totals.delta( prevTotals );
|
||||
bool missingAssertions = false;
|
||||
if( deltaTotals.assertions.total() == 0 &&
|
||||
( m_config.data().warnings & ConfigData::WarnAbout::NoAssertions ) ) {
|
||||
m_totals.assertions.failed++;
|
||||
deltaTotals = m_totals.delta( prevTotals );
|
||||
m_reporter->NoAssertionsInTestCase( testInfo.name );
|
||||
missingAssertions = true;
|
||||
}
|
||||
|
||||
m_totals.testCases += deltaTotals.testCases;
|
||||
|
||||
TestCaseStats stats( testInfo, deltaTotals, redirectedCout, redirectedCerr , aborting() );
|
||||
TestCaseStats stats( testInfo, deltaTotals, redirectedCout, redirectedCerr, missingAssertions, aborting() );
|
||||
reporter.testCaseEnding( stats );
|
||||
|
||||
|
||||
@ -150,7 +152,7 @@ namespace Catch {
|
||||
}
|
||||
|
||||
virtual void testEnded( const AssertionResult& result ) {
|
||||
LegacyReporterAdapter reporter( m_reporter );
|
||||
LegacyReporterAdapter reporter( m_reporter, ReporterConfig( m_config.stream(), m_config.data() ) );
|
||||
if( result.getResultType() == ResultWas::Ok ) {
|
||||
m_totals.assertions.passed++;
|
||||
}
|
||||
|
@ -54,27 +54,27 @@ namespace Catch {
|
||||
|
||||
void ReportCounts( const std::string& label, const Counts& counts, const std::string& allPrefix = "All " ) {
|
||||
if( counts.passed )
|
||||
m_config.stream << counts.failed << " of " << counts.total() << " " << label << "s failed";
|
||||
m_config.stream() << counts.failed << " of " << counts.total() << " " << label << "s failed";
|
||||
else
|
||||
m_config.stream << ( counts.failed > 1 ? allPrefix : "" ) << pluralise( counts.failed, label ) << " failed";
|
||||
m_config.stream() << ( counts.failed > 1 ? allPrefix : "" ) << pluralise( counts.failed, label ) << " failed";
|
||||
}
|
||||
|
||||
void ReportCounts( const Totals& totals, const std::string& allPrefix = "All " ) {
|
||||
if( totals.assertions.total() == 0 ) {
|
||||
m_config.stream << "No tests ran";
|
||||
m_config.stream() << "No tests ran";
|
||||
}
|
||||
else if( totals.assertions.failed ) {
|
||||
TextColour colour( TextColour::ResultError );
|
||||
ReportCounts( "test case", totals.testCases, allPrefix );
|
||||
if( totals.testCases.failed > 0 ) {
|
||||
m_config.stream << " (";
|
||||
m_config.stream() << " (";
|
||||
ReportCounts( "assertion", totals.assertions, allPrefix );
|
||||
m_config.stream << ")";
|
||||
m_config.stream() << ")";
|
||||
}
|
||||
}
|
||||
else {
|
||||
TextColour colour( TextColour::ResultSuccess );
|
||||
m_config.stream << allPrefix << "tests passed ("
|
||||
m_config.stream() << allPrefix << "tests passed ("
|
||||
<< pluralise( totals.assertions.passed, "assertion" ) << " in "
|
||||
<< pluralise( totals.testCases.passed, "test case" ) << ")";
|
||||
}
|
||||
@ -97,14 +97,14 @@ namespace Catch {
|
||||
virtual void EndTesting( const Totals& totals ) {
|
||||
// Output the overall test results even if "Started Testing" was not emitted
|
||||
if( m_aborted ) {
|
||||
m_config.stream << "\n[Testing aborted. ";
|
||||
m_config.stream() << "\n[Testing aborted. ";
|
||||
ReportCounts( totals, "The first " );
|
||||
}
|
||||
else {
|
||||
m_config.stream << "\n[Testing completed. ";
|
||||
m_config.stream() << "\n[Testing completed. ";
|
||||
ReportCounts( totals );
|
||||
}
|
||||
m_config.stream << "]\n" << std::endl;
|
||||
m_config.stream() << "]\n" << std::endl;
|
||||
}
|
||||
|
||||
virtual void StartGroup( const std::string& groupName ) {
|
||||
@ -113,9 +113,9 @@ namespace Catch {
|
||||
|
||||
virtual void EndGroup( const std::string& groupName, const Totals& totals ) {
|
||||
if( m_groupSpan.emitted && !groupName.empty() ) {
|
||||
m_config.stream << "[End of group: '" << groupName << "'. ";
|
||||
m_config.stream() << "[End of group: '" << groupName << "'. ";
|
||||
ReportCounts( totals );
|
||||
m_config.stream << "]\n" << std::endl;
|
||||
m_config.stream() << "]\n" << std::endl;
|
||||
m_groupSpan = SpanInfo();
|
||||
}
|
||||
}
|
||||
@ -131,19 +131,19 @@ namespace Catch {
|
||||
virtual void NoAssertionsInSection( const std::string& sectionName ) {
|
||||
startSpansLazily();
|
||||
TextColour colour( TextColour::ResultError );
|
||||
m_config.stream << "\nNo assertions in section, '" << sectionName << "'\n" << std::endl;
|
||||
m_config.stream() << "\nNo assertions in section, '" << sectionName << "'\n" << std::endl;
|
||||
}
|
||||
virtual void NoAssertionsInTestCase( const std::string& testName ) {
|
||||
startSpansLazily();
|
||||
TextColour colour( TextColour::ResultError );
|
||||
m_config.stream << "\nNo assertions in test case, '" << testName << "'\n" << std::endl;
|
||||
m_config.stream() << "\nNo assertions in test case, '" << testName << "'\n" << std::endl;
|
||||
}
|
||||
|
||||
virtual void EndSection( const std::string& sectionName, const Counts& assertions ) {
|
||||
|
||||
SpanInfo& sectionSpan = m_sectionSpans.back();
|
||||
if( sectionSpan.emitted && !sectionSpan.name.empty() ) {
|
||||
m_config.stream << "[End of section: '" << sectionName << "' ";
|
||||
m_config.stream() << "[End of section: '" << sectionName << "' ";
|
||||
|
||||
if( assertions.failed ) {
|
||||
TextColour colour( TextColour::ResultError );
|
||||
@ -151,38 +151,38 @@ namespace Catch {
|
||||
}
|
||||
else {
|
||||
TextColour colour( TextColour::ResultSuccess );
|
||||
m_config.stream << ( assertions.passed > 1 ? "All " : "" )
|
||||
m_config.stream() << ( assertions.passed > 1 ? "All " : "" )
|
||||
<< pluralise( assertions.passed, "assertion" ) << " passed" ;
|
||||
}
|
||||
m_config.stream << "]\n" << std::endl;
|
||||
m_config.stream() << "]\n" << std::endl;
|
||||
}
|
||||
m_sectionSpans.pop_back();
|
||||
}
|
||||
|
||||
virtual void Result( const AssertionResult& assertionResult ) {
|
||||
if( !m_config.includeSuccessfulResults && assertionResult.getResultType() == ResultWas::Ok )
|
||||
if( !m_config.includeSuccessfulResults() && assertionResult.getResultType() == ResultWas::Ok )
|
||||
return;
|
||||
|
||||
startSpansLazily();
|
||||
|
||||
if( !assertionResult.getSourceInfo().empty() ) {
|
||||
TextColour colour( TextColour::FileName );
|
||||
m_config.stream << assertionResult.getSourceInfo();
|
||||
m_config.stream() << assertionResult.getSourceInfo();
|
||||
}
|
||||
|
||||
if( assertionResult.hasExpression() ) {
|
||||
TextColour colour( TextColour::OriginalExpression );
|
||||
m_config.stream << assertionResult.getExpression();
|
||||
m_config.stream() << assertionResult.getExpression();
|
||||
if( assertionResult.succeeded() ) {
|
||||
TextColour successColour( TextColour::Success );
|
||||
m_config.stream << " succeeded";
|
||||
m_config.stream() << " succeeded";
|
||||
}
|
||||
else {
|
||||
TextColour errorColour( TextColour::Error );
|
||||
m_config.stream << " failed";
|
||||
m_config.stream() << " failed";
|
||||
if( assertionResult.isOk() ) {
|
||||
TextColour okAnywayColour( TextColour::Success );
|
||||
m_config.stream << " - but was ok";
|
||||
m_config.stream() << " - but was ok";
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -191,19 +191,19 @@ namespace Catch {
|
||||
{
|
||||
TextColour colour( TextColour::Error );
|
||||
if( assertionResult.hasExpression() )
|
||||
m_config.stream << " with unexpected";
|
||||
m_config.stream() << " with unexpected";
|
||||
else
|
||||
m_config.stream << "Unexpected";
|
||||
m_config.stream << " exception with message: '" << assertionResult.getMessage() << "'";
|
||||
m_config.stream() << "Unexpected";
|
||||
m_config.stream() << " exception with message: '" << assertionResult.getMessage() << "'";
|
||||
}
|
||||
break;
|
||||
case ResultWas::DidntThrowException:
|
||||
{
|
||||
TextColour colour( TextColour::Error );
|
||||
if( assertionResult.hasExpression() )
|
||||
m_config.stream << " because no exception was thrown where one was expected";
|
||||
m_config.stream() << " because no exception was thrown where one was expected";
|
||||
else
|
||||
m_config.stream << "No exception thrown where one was expected";
|
||||
m_config.stream() << "No exception thrown where one was expected";
|
||||
}
|
||||
break;
|
||||
case ResultWas::Info:
|
||||
@ -221,7 +221,7 @@ namespace Catch {
|
||||
case ResultWas::ExplicitFailure:
|
||||
{
|
||||
TextColour colour( TextColour::Error );
|
||||
m_config.stream << "failed with message: '" << assertionResult.getMessage() << "'";
|
||||
m_config.stream() << "failed with message: '" << assertionResult.getMessage() << "'";
|
||||
}
|
||||
break;
|
||||
case ResultWas::Unknown: // These cases are here to prevent compiler warnings
|
||||
@ -232,19 +232,19 @@ namespace Catch {
|
||||
if( !assertionResult.hasExpression() ) {
|
||||
if( assertionResult.succeeded() ) {
|
||||
TextColour colour( TextColour::Success );
|
||||
m_config.stream << " succeeded";
|
||||
m_config.stream() << " succeeded";
|
||||
}
|
||||
else {
|
||||
TextColour colour( TextColour::Error );
|
||||
m_config.stream << " failed";
|
||||
m_config.stream() << " failed";
|
||||
if( assertionResult.isOk() ) {
|
||||
TextColour okAnywayColour( TextColour::Success );
|
||||
m_config.stream << " - but was ok";
|
||||
m_config.stream() << " - but was ok";
|
||||
}
|
||||
}
|
||||
}
|
||||
if( assertionResult.hasMessage() ) {
|
||||
m_config.stream << "\n";
|
||||
m_config.stream() << "\n";
|
||||
TextColour colour( TextColour::ReconstructedExpression );
|
||||
streamVariableLengthText( "with message", assertionResult.getMessage() );
|
||||
}
|
||||
@ -252,16 +252,16 @@ namespace Catch {
|
||||
}
|
||||
|
||||
if( assertionResult.hasExpandedExpression() ) {
|
||||
m_config.stream << " for: ";
|
||||
m_config.stream() << " for: ";
|
||||
if( assertionResult.getExpandedExpression().size() > 40 ) {
|
||||
m_config.stream << "\n";
|
||||
m_config.stream() << "\n";
|
||||
if( assertionResult.getExpandedExpression().size() < 70 )
|
||||
m_config.stream << "\t";
|
||||
m_config.stream() << "\t";
|
||||
}
|
||||
TextColour colour( TextColour::ReconstructedExpression );
|
||||
m_config.stream << assertionResult.getExpandedExpression();
|
||||
m_config.stream() << assertionResult.getExpandedExpression();
|
||||
}
|
||||
m_config.stream << std::endl;
|
||||
m_config.stream() << std::endl;
|
||||
}
|
||||
|
||||
virtual void EndTestCase( const TestCaseInfo& testInfo,
|
||||
@ -279,9 +279,9 @@ namespace Catch {
|
||||
}
|
||||
|
||||
if( m_testSpan.emitted ) {
|
||||
m_config.stream << "[Finished: '" << testInfo.name << "' ";
|
||||
m_config.stream() << "[Finished: '" << testInfo.name << "' ";
|
||||
ReportCounts( totals );
|
||||
m_config.stream << "]" << std::endl;
|
||||
m_config.stream() << "]" << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
@ -289,20 +289,20 @@ namespace Catch {
|
||||
|
||||
void startSpansLazily() {
|
||||
if( !m_testingSpan.emitted ) {
|
||||
if( m_config.name.empty() )
|
||||
m_config.stream << "[Started testing]" << std::endl;
|
||||
if( m_config.name().empty() )
|
||||
m_config.stream() << "[Started testing]" << std::endl;
|
||||
else
|
||||
m_config.stream << "[Started testing: " << m_config.name << "]" << std::endl;
|
||||
m_config.stream() << "[Started testing: " << m_config.name() << "]" << std::endl;
|
||||
m_testingSpan.emitted = true;
|
||||
}
|
||||
|
||||
if( !m_groupSpan.emitted && !m_groupSpan.name.empty() ) {
|
||||
m_config.stream << "[Started group: '" << m_groupSpan.name << "']" << std::endl;
|
||||
m_config.stream() << "[Started group: '" << m_groupSpan.name << "']" << std::endl;
|
||||
m_groupSpan.emitted = true;
|
||||
}
|
||||
|
||||
if( !m_testSpan.emitted ) {
|
||||
m_config.stream << std::endl << "[Running: " << m_testSpan.name << "]" << std::endl;
|
||||
m_config.stream() << std::endl << "[Running: " << m_testSpan.name << "]" << std::endl;
|
||||
m_testSpan.emitted = true;
|
||||
}
|
||||
|
||||
@ -310,7 +310,7 @@ namespace Catch {
|
||||
SpanInfo& sectionSpan = m_sectionSpans.back();
|
||||
if( !sectionSpan.emitted && !sectionSpan.name.empty() ) {
|
||||
if( m_firstSectionInTestCase ) {
|
||||
m_config.stream << "\n";
|
||||
m_config.stream() << "\n";
|
||||
m_firstSectionInTestCase = false;
|
||||
}
|
||||
std::vector<SpanInfo>::iterator it = m_sectionSpans.begin();
|
||||
@ -318,7 +318,7 @@ namespace Catch {
|
||||
for(; it != itEnd; ++it ) {
|
||||
SpanInfo& prevSpan = *it;
|
||||
if( !prevSpan.emitted && !prevSpan.name.empty() ) {
|
||||
m_config.stream << "[Started section: '" << prevSpan.name << "']" << std::endl;
|
||||
m_config.stream() << "[Started section: '" << prevSpan.name << "']" << std::endl;
|
||||
prevSpan.emitted = true;
|
||||
}
|
||||
}
|
||||
@ -329,10 +329,10 @@ namespace Catch {
|
||||
void streamVariableLengthText( const std::string& prefix, const std::string& text ) {
|
||||
std::string trimmed = trim( text );
|
||||
if( trimmed.find_first_of( "\r\n" ) == std::string::npos ) {
|
||||
m_config.stream << "[" << prefix << ": " << trimmed << "]";
|
||||
m_config.stream() << "[" << prefix << ": " << trimmed << "]";
|
||||
}
|
||||
else {
|
||||
m_config.stream << "\n[" << prefix << "] >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n" << trimmed
|
||||
m_config.stream() << "\n[" << prefix << "] >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n" << trimmed
|
||||
<< "\n[end of " << prefix << "] <<<<<<<<<<<<<<<<<<<<<<<<\n";
|
||||
}
|
||||
}
|
||||
|
@ -84,7 +84,7 @@ namespace Catch {
|
||||
|
||||
virtual void StartGroup( const std::string& groupName ) {
|
||||
if( groupName.empty() )
|
||||
m_statsForSuites.push_back( Stats( m_config.name ) );
|
||||
m_statsForSuites.push_back( Stats( m_config.name() ) );
|
||||
else
|
||||
m_statsForSuites.push_back( Stats( groupName ) );
|
||||
m_currentStats = &m_statsForSuites.back();
|
||||
@ -108,7 +108,7 @@ namespace Catch {
|
||||
}
|
||||
|
||||
virtual void Result( const Catch::AssertionResult& assertionResult ) {
|
||||
if( assertionResult.getResultType() != ResultWas::Ok || m_config.includeSuccessfulResults ) {
|
||||
if( assertionResult.getResultType() != ResultWas::Ok || m_config.includeSuccessfulResults() ) {
|
||||
TestCaseStats& testCaseStats = m_currentStats->m_testCaseStats.back();
|
||||
TestStats stats;
|
||||
std::ostringstream oss;
|
||||
@ -168,32 +168,29 @@ namespace Catch {
|
||||
}
|
||||
|
||||
virtual void EndTesting( const Totals& ) {
|
||||
std::ostream& str = m_config.stream;
|
||||
{
|
||||
XmlWriter xml( str );
|
||||
XmlWriter xml( m_config.stream() );
|
||||
|
||||
if( m_statsForSuites.size() > 0 )
|
||||
xml.startElement( "testsuites" );
|
||||
|
||||
std::vector<Stats>::const_iterator it = m_statsForSuites.begin();
|
||||
std::vector<Stats>::const_iterator itEnd = m_statsForSuites.end();
|
||||
|
||||
for(; it != itEnd; ++it ) {
|
||||
XmlWriter::ScopedElement e = xml.scopedElement( "testsuite" );
|
||||
xml.writeAttribute( "name", it->m_name );
|
||||
xml.writeAttribute( "errors", it->m_errorsCount );
|
||||
xml.writeAttribute( "failures", it->m_failuresCount );
|
||||
xml.writeAttribute( "tests", it->m_testsCount );
|
||||
xml.writeAttribute( "hostname", "tbd" );
|
||||
xml.writeAttribute( "time", "tbd" );
|
||||
xml.writeAttribute( "timestamp", "tbd" );
|
||||
|
||||
if( m_statsForSuites.size() > 0 )
|
||||
xml.startElement( "testsuites" );
|
||||
|
||||
std::vector<Stats>::const_iterator it = m_statsForSuites.begin();
|
||||
std::vector<Stats>::const_iterator itEnd = m_statsForSuites.end();
|
||||
|
||||
for(; it != itEnd; ++it ) {
|
||||
XmlWriter::ScopedElement e = xml.scopedElement( "testsuite" );
|
||||
xml.writeAttribute( "name", it->m_name );
|
||||
xml.writeAttribute( "errors", it->m_errorsCount );
|
||||
xml.writeAttribute( "failures", it->m_failuresCount );
|
||||
xml.writeAttribute( "tests", it->m_testsCount );
|
||||
xml.writeAttribute( "hostname", "tbd" );
|
||||
xml.writeAttribute( "time", "tbd" );
|
||||
xml.writeAttribute( "timestamp", "tbd" );
|
||||
|
||||
OutputTestCases( xml, *it );
|
||||
}
|
||||
|
||||
xml.scopedElement( "system-out" ).writeText( trim( m_stdOut.str() ), false );
|
||||
xml.scopedElement( "system-err" ).writeText( trim( m_stdErr.str() ), false );
|
||||
OutputTestCases( xml, *it );
|
||||
}
|
||||
|
||||
xml.scopedElement( "system-out" ).writeText( trim( m_stdOut.str() ), false );
|
||||
xml.scopedElement( "system-err" ).writeText( trim( m_stdErr.str() ), false );
|
||||
}
|
||||
|
||||
void OutputTestCases( XmlWriter& xml, const Stats& stats ) {
|
||||
|
@ -30,10 +30,10 @@ namespace Catch {
|
||||
}
|
||||
|
||||
virtual void StartTesting() {
|
||||
m_xml = XmlWriter( m_config.stream );
|
||||
m_xml = XmlWriter( m_config.stream() );
|
||||
m_xml.startElement( "Catch" );
|
||||
if( !m_config.name.empty() )
|
||||
m_xml.writeAttribute( "name", m_config.name );
|
||||
if( !m_config.name().empty() )
|
||||
m_xml.writeAttribute( "name", m_config.name() );
|
||||
}
|
||||
|
||||
virtual void EndTesting( const Totals& totals ) {
|
||||
@ -76,7 +76,7 @@ namespace Catch {
|
||||
}
|
||||
|
||||
virtual void Result( const Catch::AssertionResult& assertionResult ) {
|
||||
if( !m_config.includeSuccessfulResults && assertionResult.getResultType() == ResultWas::Ok )
|
||||
if( !m_config.includeSuccessfulResults() && assertionResult.getResultType() == ResultWas::Ok )
|
||||
return;
|
||||
|
||||
if( assertionResult.hasExpression() ) {
|
||||
|
@ -196,12 +196,12 @@
|
||||
[Running: ./succeeding/conditions/ptr]
|
||||
/Users/Phil/Dev/OSS/Catch/projects/XCode4/CatchSelfTest/CatchSelfTest/../../../SelfTest/ConditionTests.cpp:285: p == __null succeeded for: __null == 0
|
||||
/Users/Phil/Dev/OSS/Catch/projects/XCode4/CatchSelfTest/CatchSelfTest/../../../SelfTest/ConditionTests.cpp:286: p == pNULL succeeded for: __null == __null
|
||||
/Users/Phil/Dev/OSS/Catch/projects/XCode4/CatchSelfTest/CatchSelfTest/../../../SelfTest/ConditionTests.cpp:291: p != __null succeeded for: 0x7fff5c7c3f58 != 0
|
||||
/Users/Phil/Dev/OSS/Catch/projects/XCode4/CatchSelfTest/CatchSelfTest/../../../SelfTest/ConditionTests.cpp:294: cp != __null succeeded for: 0x7fff5c7c3f58 != 0
|
||||
/Users/Phil/Dev/OSS/Catch/projects/XCode4/CatchSelfTest/CatchSelfTest/../../../SelfTest/ConditionTests.cpp:297: cpc != __null succeeded for: 0x7fff5c7c3f58 != 0
|
||||
/Users/Phil/Dev/OSS/Catch/projects/XCode4/CatchSelfTest/CatchSelfTest/../../../SelfTest/ConditionTests.cpp:291: p != __null succeeded for: 0x7fff55ab3d88 != 0
|
||||
/Users/Phil/Dev/OSS/Catch/projects/XCode4/CatchSelfTest/CatchSelfTest/../../../SelfTest/ConditionTests.cpp:294: cp != __null succeeded for: 0x7fff55ab3d88 != 0
|
||||
/Users/Phil/Dev/OSS/Catch/projects/XCode4/CatchSelfTest/CatchSelfTest/../../../SelfTest/ConditionTests.cpp:297: cpc != __null succeeded for: 0x7fff55ab3d88 != 0
|
||||
/Users/Phil/Dev/OSS/Catch/projects/XCode4/CatchSelfTest/CatchSelfTest/../../../SelfTest/ConditionTests.cpp:299: returnsNull() == __null succeeded for: {null string} == 0
|
||||
/Users/Phil/Dev/OSS/Catch/projects/XCode4/CatchSelfTest/CatchSelfTest/../../../SelfTest/ConditionTests.cpp:300: returnsConstNull() == __null succeeded for: {null string} == 0
|
||||
/Users/Phil/Dev/OSS/Catch/projects/XCode4/CatchSelfTest/CatchSelfTest/../../../SelfTest/ConditionTests.cpp:302: __null != p succeeded for: 0 != 0x7fff5c7c3f58
|
||||
/Users/Phil/Dev/OSS/Catch/projects/XCode4/CatchSelfTest/CatchSelfTest/../../../SelfTest/ConditionTests.cpp:302: __null != p succeeded for: 0 != 0x7fff55ab3d88
|
||||
[Finished: './succeeding/conditions/ptr' All tests passed (8 assertions in 1 test case)]
|
||||
|
||||
[Running: ./succeeding/conditions/not]
|
||||
@ -1357,7 +1357,7 @@ No assertions in test case, './inprogress/failing/Tricky/compound lhs'
|
||||
[Finished: './inprogress/failing/Tricky/compound lhs' 1 test case failed (1 assertion failed)]
|
||||
|
||||
[Running: ./failing/Tricky/non streamable type]
|
||||
/Users/Phil/Dev/OSS/Catch/projects/XCode4/CatchSelfTest/CatchSelfTest/../../../SelfTest/TrickyTests.cpp:95: &o1 == &o2 failed for: 0x7fff5c7c4738 == 0x7fff5c7c4730
|
||||
/Users/Phil/Dev/OSS/Catch/projects/XCode4/CatchSelfTest/CatchSelfTest/../../../SelfTest/TrickyTests.cpp:95: &o1 == &o2 failed for: 0x7fff55ab4568 == 0x7fff55ab4560
|
||||
/Users/Phil/Dev/OSS/Catch/projects/XCode4/CatchSelfTest/CatchSelfTest/../../../SelfTest/TrickyTests.cpp:96: o1 == o2 failed for: {?} == {?}
|
||||
[Finished: './failing/Tricky/non streamable type' 1 test case failed (All 2 assertions failed)]
|
||||
|
||||
@ -1383,7 +1383,7 @@ No assertions in test case, './inprogress/failing/Tricky/compound lhs'
|
||||
[Finished: './succeeding/enum/bits' All tests passed (1 assertion in 1 test case)]
|
||||
|
||||
[Running: ./succeeding/boolean member]
|
||||
/Users/Phil/Dev/OSS/Catch/projects/XCode4/CatchSelfTest/CatchSelfTest/../../../SelfTest/TrickyTests.cpp:239: obj.prop != __null succeeded for: 0x7fff5c7c4730 != 0
|
||||
/Users/Phil/Dev/OSS/Catch/projects/XCode4/CatchSelfTest/CatchSelfTest/../../../SelfTest/TrickyTests.cpp:239: obj.prop != __null succeeded for: 0x7fff55ab4560 != 0
|
||||
[Finished: './succeeding/boolean member' All tests passed (1 assertion in 1 test case)]
|
||||
|
||||
[Running: ./succeeding/unimplemented static bool]
|
||||
|
Loading…
Reference in New Issue
Block a user