mirror of
https://github.com/catchorg/Catch2.git
synced 2024-11-26 07:16:10 +01:00
Reformatting
This commit is contained in:
parent
6cd2ac7544
commit
0afa09f7c1
@ -35,7 +35,7 @@ namespace Catch
|
|||||||
virtual void EndTesting( const Totals& totals ) = 0;
|
virtual void EndTesting( const Totals& totals ) = 0;
|
||||||
virtual void StartGroup( const std::string& groupName ) = 0;
|
virtual void StartGroup( const std::string& groupName ) = 0;
|
||||||
virtual void EndGroup( const std::string& groupName, const Totals& totals ) = 0;
|
virtual void EndGroup( const std::string& groupName, const Totals& totals ) = 0;
|
||||||
virtual void StartSection( const std::string& sectionName, const std::string description ) = 0;
|
virtual void StartSection( const std::string& sectionName, const std::string& description ) = 0;
|
||||||
virtual void EndSection( const std::string& sectionName, const Counts& assertions ) = 0;
|
virtual void EndSection( const std::string& sectionName, const Counts& assertions ) = 0;
|
||||||
virtual void StartTestCase( const TestCaseInfo& testInfo ) = 0;
|
virtual void StartTestCase( const TestCaseInfo& testInfo ) = 0;
|
||||||
virtual void EndTestCase( const TestCaseInfo& testInfo, const Totals& totals, const std::string& stdOut, const std::string& stdErr ) = 0;
|
virtual void EndTestCase( const TestCaseInfo& testInfo, const Totals& totals, const std::string& stdOut, const std::string& stdErr ) = 0;
|
||||||
|
@ -1,13 +1,9 @@
|
|||||||
/*
|
/*
|
||||||
* catch_reporter_basic.hpp
|
|
||||||
* Catch
|
|
||||||
*
|
|
||||||
* Created by Phil on 28/10/2010.
|
* Created by Phil on 28/10/2010.
|
||||||
* Copyright 2010 Two Blue Cubes Ltd. All rights reserved.
|
* Copyright 2010 Two Blue Cubes Ltd. All rights reserved.
|
||||||
*
|
*
|
||||||
* Distributed under the Boost Software License, Version 1.0. (See accompanying
|
* Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||||
* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
#ifndef TWOBLUECUBES_CATCH_REPORTER_BASIC_HPP_INCLUDED
|
#ifndef TWOBLUECUBES_CATCH_REPORTER_BASIC_HPP_INCLUDED
|
||||||
#define TWOBLUECUBES_CATCH_REPORTER_BASIC_HPP_INCLUDED
|
#define TWOBLUECUBES_CATCH_REPORTER_BASIC_HPP_INCLUDED
|
||||||
@ -17,17 +13,15 @@
|
|||||||
#include "../internal/catch_reporter_registrars.hpp"
|
#include "../internal/catch_reporter_registrars.hpp"
|
||||||
#include "../internal/catch_console_colour.hpp"
|
#include "../internal/catch_console_colour.hpp"
|
||||||
|
|
||||||
namespace Catch
|
namespace Catch {
|
||||||
{
|
|
||||||
struct pluralise
|
struct pluralise {
|
||||||
{
|
|
||||||
pluralise( std::size_t count, const std::string& label )
|
pluralise( std::size_t count, const std::string& label )
|
||||||
: m_count( count ),
|
: m_count( count ),
|
||||||
m_label( label )
|
m_label( label )
|
||||||
{}
|
{}
|
||||||
|
|
||||||
friend std::ostream& operator << ( std::ostream& os, const pluralise& pluraliser )
|
friend std::ostream& operator << ( std::ostream& os, const pluralise& pluraliser ) {
|
||||||
{
|
|
||||||
os << pluraliser.m_count << " " << pluraliser.m_label;
|
os << pluraliser.m_count << " " << pluraliser.m_label;
|
||||||
if( pluraliser.m_count != 1 )
|
if( pluraliser.m_count != 1 )
|
||||||
os << "s";
|
os << "s";
|
||||||
@ -38,10 +32,10 @@ namespace Catch
|
|||||||
std::string m_label;
|
std::string m_label;
|
||||||
};
|
};
|
||||||
|
|
||||||
class BasicReporter : public SharedImpl<IReporter>
|
class BasicReporter : public SharedImpl<IReporter> {
|
||||||
{
|
|
||||||
struct SpanInfo
|
struct SpanInfo {
|
||||||
{
|
|
||||||
SpanInfo()
|
SpanInfo()
|
||||||
: emitted( false )
|
: emitted( false )
|
||||||
{}
|
{}
|
||||||
@ -61,61 +55,38 @@ namespace Catch
|
|||||||
};
|
};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
///////////////////////////////////////////////////////////////////////////
|
BasicReporter( const IReporterConfig& config )
|
||||||
BasicReporter
|
|
||||||
(
|
|
||||||
const IReporterConfig& config
|
|
||||||
)
|
|
||||||
: m_config( config ),
|
: m_config( config ),
|
||||||
m_firstSectionInTestCase( true )
|
m_firstSectionInTestCase( true )
|
||||||
{
|
{}
|
||||||
}
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
static std::string getDescription() {
|
||||||
static std::string getDescription
|
|
||||||
()
|
|
||||||
{
|
|
||||||
return "Reports test results as lines of text";
|
return "Reports test results as lines of text";
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
void ReportCounts( const std::string& label, const Counts& counts ) {
|
||||||
void ReportCounts
|
|
||||||
(
|
|
||||||
const std::string& label,
|
|
||||||
const Counts& counts
|
|
||||||
)
|
|
||||||
{
|
|
||||||
if( counts.passed )
|
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
|
else
|
||||||
m_config.stream() << ( counts.failed > 1 ? "All " : "" ) << pluralise( counts.failed, label ) << " failed";
|
m_config.stream() << ( counts.failed > 1 ? "All " : "" ) << pluralise( counts.failed, label ) << " failed";
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
void ReportCounts( const Totals& totals ) {
|
||||||
void ReportCounts
|
if( totals.assertions.total() == 0 ) {
|
||||||
(
|
|
||||||
const Totals& totals
|
|
||||||
)
|
|
||||||
{
|
|
||||||
if( totals.assertions.total() == 0 )
|
|
||||||
{
|
|
||||||
m_config.stream() << "No tests ran";
|
m_config.stream() << "No tests ran";
|
||||||
}
|
}
|
||||||
else if( totals.assertions.failed )
|
else if( totals.assertions.failed ) {
|
||||||
{
|
|
||||||
TextColour colour( TextColour::ResultError );
|
TextColour colour( TextColour::ResultError );
|
||||||
ReportCounts( "test case", totals.testCases );
|
ReportCounts( "test case", totals.testCases );
|
||||||
if( totals.testCases.failed > 0 )
|
if( totals.testCases.failed > 0 ) {
|
||||||
{
|
|
||||||
m_config.stream() << " (";
|
m_config.stream() << " (";
|
||||||
ReportCounts( "assertion", totals.assertions );
|
ReportCounts( "assertion", totals.assertions );
|
||||||
m_config.stream() << ")";
|
m_config.stream() << ")";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
TextColour colour( TextColour::ResultSuccess );
|
TextColour colour( TextColour::ResultSuccess );
|
||||||
m_config.stream() << "All tests passed ("
|
m_config.stream() << "All tests passed ("
|
||||||
<< pluralise( totals.assertions.passed, "assertion" ) << " in "
|
<< pluralise( totals.assertions.passed, "assertion" ) << " in "
|
||||||
@ -125,51 +96,27 @@ namespace Catch
|
|||||||
|
|
||||||
private: // IReporter
|
private: // IReporter
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
virtual bool shouldRedirectStdout() const {
|
||||||
virtual bool shouldRedirectStdout
|
|
||||||
()
|
|
||||||
const
|
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
virtual void StartTesting() {
|
||||||
virtual void StartTesting
|
|
||||||
()
|
|
||||||
{
|
|
||||||
m_testingSpan = SpanInfo();
|
m_testingSpan = SpanInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
virtual void EndTesting( const Totals& totals ) {
|
||||||
virtual void EndTesting
|
|
||||||
(
|
|
||||||
const Totals& totals
|
|
||||||
)
|
|
||||||
{
|
|
||||||
// Output the overall test results even if "Started Testing" was not emitted
|
// Output the overall test results even if "Started Testing" was not emitted
|
||||||
m_config.stream() << "\n[Testing completed. ";
|
m_config.stream() << "\n[Testing completed. ";
|
||||||
ReportCounts( totals);
|
ReportCounts( totals);
|
||||||
m_config.stream() << "]\n" << std::endl;
|
m_config.stream() << "]\n" << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
virtual void StartGroup( const std::string& groupName ) {
|
||||||
virtual void StartGroup
|
|
||||||
(
|
|
||||||
const std::string& groupName
|
|
||||||
)
|
|
||||||
{
|
|
||||||
m_groupSpan = groupName;
|
m_groupSpan = groupName;
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
virtual void EndGroup( const std::string& groupName, const Totals& totals ) {
|
||||||
virtual void EndGroup
|
if( m_groupSpan.emitted && !groupName.empty() ) {
|
||||||
(
|
|
||||||
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 );
|
ReportCounts( totals );
|
||||||
m_config.stream() << "]\n" << std::endl;
|
m_config.stream() << "]\n" << std::endl;
|
||||||
@ -177,44 +124,24 @@ namespace Catch
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
virtual void StartTestCase( const TestCaseInfo& testInfo ) {
|
||||||
virtual void StartTestCase
|
|
||||||
(
|
|
||||||
const TestCaseInfo& testInfo
|
|
||||||
)
|
|
||||||
{
|
|
||||||
m_testSpan = testInfo.getName();
|
m_testSpan = testInfo.getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
virtual void StartSection( const std::string& sectionName, const std::string& ) {
|
||||||
virtual void StartSection
|
|
||||||
(
|
|
||||||
const std::string& sectionName,
|
|
||||||
const std::string /*description*/
|
|
||||||
)
|
|
||||||
{
|
|
||||||
m_sectionSpans.push_back( SpanInfo( sectionName ) );
|
m_sectionSpans.push_back( SpanInfo( sectionName ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
virtual void EndSection( const std::string& sectionName, const Counts& assertions ) {
|
||||||
virtual void EndSection
|
|
||||||
(
|
|
||||||
const std::string& sectionName,
|
|
||||||
const Counts& assertions
|
|
||||||
)
|
|
||||||
{
|
|
||||||
SpanInfo& sectionSpan = m_sectionSpans.back();
|
SpanInfo& sectionSpan = m_sectionSpans.back();
|
||||||
if( sectionSpan.emitted && !sectionSpan.name.empty() )
|
if( sectionSpan.emitted && !sectionSpan.name.empty() ) {
|
||||||
{
|
|
||||||
m_config.stream() << "[End of section: '" << sectionName << "' ";
|
m_config.stream() << "[End of section: '" << sectionName << "' ";
|
||||||
|
|
||||||
if( assertions.failed )
|
if( assertions.failed ) {
|
||||||
{
|
|
||||||
TextColour colour( TextColour::ResultError );
|
TextColour colour( TextColour::ResultError );
|
||||||
ReportCounts( "assertion", assertions);
|
ReportCounts( "assertion", assertions);
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
TextColour colour( TextColour::ResultSuccess );
|
TextColour colour( TextColour::ResultSuccess );
|
||||||
m_config.stream() << ( assertions.passed > 1 ? "All " : "" )
|
m_config.stream() << ( assertions.passed > 1 ? "All " : "" )
|
||||||
<< pluralise( assertions.passed, "assertion" ) << "passed" ;
|
<< pluralise( assertions.passed, "assertion" ) << "passed" ;
|
||||||
@ -224,40 +151,30 @@ namespace Catch
|
|||||||
m_sectionSpans.pop_back();
|
m_sectionSpans.pop_back();
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
virtual void Result( const ResultInfo& resultInfo ) {
|
||||||
virtual void Result
|
|
||||||
(
|
|
||||||
const ResultInfo& resultInfo
|
|
||||||
)
|
|
||||||
{
|
|
||||||
if( !m_config.includeSuccessfulResults() && resultInfo.getResultType() == ResultWas::Ok )
|
if( !m_config.includeSuccessfulResults() && resultInfo.getResultType() == ResultWas::Ok )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
StartSpansLazily();
|
StartSpansLazily();
|
||||||
|
|
||||||
if( !resultInfo.getFilename().empty() )
|
if( !resultInfo.getFilename().empty() ) {
|
||||||
{
|
|
||||||
TextColour colour( TextColour::FileName );
|
TextColour colour( TextColour::FileName );
|
||||||
m_config.stream() << SourceLineInfo( resultInfo.getFilename(), resultInfo.getLine() );
|
m_config.stream() << SourceLineInfo( resultInfo.getFilename(), resultInfo.getLine() );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( resultInfo.hasExpression() )
|
if( resultInfo.hasExpression() ) {
|
||||||
{
|
|
||||||
TextColour colour( TextColour::OriginalExpression );
|
TextColour colour( TextColour::OriginalExpression );
|
||||||
m_config.stream() << resultInfo.getExpression();
|
m_config.stream() << resultInfo.getExpression();
|
||||||
if( resultInfo.ok() )
|
if( resultInfo.ok() ) {
|
||||||
{
|
|
||||||
TextColour successColour( TextColour::Success );
|
TextColour successColour( TextColour::Success );
|
||||||
m_config.stream() << " succeeded";
|
m_config.stream() << " succeeded";
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
TextColour errorColour( TextColour::Error );
|
TextColour errorColour( TextColour::Error );
|
||||||
m_config.stream() << " failed";
|
m_config.stream() << " failed";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
switch( resultInfo.getResultType() )
|
switch( resultInfo.getResultType() ) {
|
||||||
{
|
|
||||||
case ResultWas::ThrewException:
|
case ResultWas::ThrewException:
|
||||||
{
|
{
|
||||||
TextColour colour( TextColour::Error );
|
TextColour colour( TextColour::Error );
|
||||||
@ -295,15 +212,12 @@ namespace Catch
|
|||||||
case ResultWas::ExpressionFailed:
|
case ResultWas::ExpressionFailed:
|
||||||
case ResultWas::Exception:
|
case ResultWas::Exception:
|
||||||
default:
|
default:
|
||||||
if( !resultInfo.hasExpression() )
|
if( !resultInfo.hasExpression() ) {
|
||||||
{
|
if( resultInfo.ok() ) {
|
||||||
if( resultInfo.ok() )
|
|
||||||
{
|
|
||||||
TextColour colour( TextColour::Success );
|
TextColour colour( TextColour::Success );
|
||||||
m_config.stream() << " succeeded";
|
m_config.stream() << " succeeded";
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
TextColour colour( TextColour::Error );
|
TextColour colour( TextColour::Error );
|
||||||
m_config.stream() << " failed";
|
m_config.stream() << " failed";
|
||||||
}
|
}
|
||||||
@ -311,8 +225,7 @@ namespace Catch
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( resultInfo.hasExpandedExpression() )
|
if( resultInfo.hasExpandedExpression() ) {
|
||||||
{
|
|
||||||
m_config.stream() << " for: ";
|
m_config.stream() << " for: ";
|
||||||
TextColour colour( TextColour::ReconstructedExpression );
|
TextColour colour( TextColour::ReconstructedExpression );
|
||||||
m_config.stream() << resultInfo.getExpandedExpression();
|
m_config.stream() << resultInfo.getExpandedExpression();
|
||||||
@ -320,29 +233,21 @@ namespace Catch
|
|||||||
m_config.stream() << std::endl;
|
m_config.stream() << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
virtual void EndTestCase( const TestCaseInfo& testInfo,
|
||||||
virtual void EndTestCase
|
const Totals& totals,
|
||||||
(
|
const std::string& stdOut,
|
||||||
const TestCaseInfo& testInfo,
|
const std::string& stdErr ) {
|
||||||
const Totals& totals,
|
if( !stdOut.empty() ) {
|
||||||
const std::string& stdOut,
|
|
||||||
const std::string& stdErr
|
|
||||||
)
|
|
||||||
{
|
|
||||||
if( !stdOut.empty() )
|
|
||||||
{
|
|
||||||
StartSpansLazily();
|
StartSpansLazily();
|
||||||
streamVariableLengthText( "stdout", stdOut );
|
streamVariableLengthText( "stdout", stdOut );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !stdErr.empty() )
|
if( !stdErr.empty() ) {
|
||||||
{
|
|
||||||
StartSpansLazily();
|
StartSpansLazily();
|
||||||
streamVariableLengthText( "stderr", stdErr );
|
streamVariableLengthText( "stderr", stdErr );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( m_testSpan.emitted )
|
if( m_testSpan.emitted ) {
|
||||||
{
|
|
||||||
m_config.stream() << "[Finished: '" << testInfo.getName() << "' ";
|
m_config.stream() << "[Finished: '" << testInfo.getName() << "' ";
|
||||||
ReportCounts( totals );
|
ReportCounts( totals );
|
||||||
m_config.stream() << "]" << std::endl;
|
m_config.stream() << "]" << std::endl;
|
||||||
@ -351,11 +256,8 @@ namespace Catch
|
|||||||
|
|
||||||
private: // helpers
|
private: // helpers
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
void StartSpansLazily() {
|
||||||
void StartSpansLazily()
|
if( !m_testingSpan.emitted ) {
|
||||||
{
|
|
||||||
if( !m_testingSpan.emitted )
|
|
||||||
{
|
|
||||||
if( m_config.getName().empty() )
|
if( m_config.getName().empty() )
|
||||||
m_config.stream() << "[Started testing]" << std::endl;
|
m_config.stream() << "[Started testing]" << std::endl;
|
||||||
else
|
else
|
||||||
@ -363,35 +265,28 @@ namespace Catch
|
|||||||
m_testingSpan.emitted = true;
|
m_testingSpan.emitted = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !m_groupSpan.emitted && !m_groupSpan.name.empty() )
|
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;
|
m_groupSpan.emitted = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !m_testSpan.emitted )
|
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;
|
m_testSpan.emitted = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !m_sectionSpans.empty() )
|
if( !m_sectionSpans.empty() ) {
|
||||||
{
|
|
||||||
SpanInfo& sectionSpan = m_sectionSpans.back();
|
SpanInfo& sectionSpan = m_sectionSpans.back();
|
||||||
if( !sectionSpan.emitted && !sectionSpan.name.empty() )
|
if( !sectionSpan.emitted && !sectionSpan.name.empty() ) {
|
||||||
{
|
if( m_firstSectionInTestCase ) {
|
||||||
if( m_firstSectionInTestCase )
|
|
||||||
{
|
|
||||||
m_config.stream() << "\n";
|
m_config.stream() << "\n";
|
||||||
m_firstSectionInTestCase = false;
|
m_firstSectionInTestCase = false;
|
||||||
}
|
}
|
||||||
std::vector<SpanInfo>::iterator it = m_sectionSpans.begin();
|
std::vector<SpanInfo>::iterator it = m_sectionSpans.begin();
|
||||||
std::vector<SpanInfo>::iterator itEnd = m_sectionSpans.end();
|
std::vector<SpanInfo>::iterator itEnd = m_sectionSpans.end();
|
||||||
for(; it != itEnd; ++it )
|
for(; it != itEnd; ++it ) {
|
||||||
{
|
|
||||||
SpanInfo& prevSpan = *it;
|
SpanInfo& prevSpan = *it;
|
||||||
if( !prevSpan.emitted && !prevSpan.name.empty() )
|
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;
|
prevSpan.emitted = true;
|
||||||
}
|
}
|
||||||
@ -400,20 +295,12 @@ namespace Catch
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
void streamVariableLengthText( const std::string& prefix, const std::string& text ) {
|
||||||
void streamVariableLengthText
|
|
||||||
(
|
|
||||||
const std::string& prefix,
|
|
||||||
const std::string& text
|
|
||||||
)
|
|
||||||
{
|
|
||||||
std::string trimmed = trim( text );
|
std::string trimmed = trim( text );
|
||||||
if( trimmed.find_first_of( "\r\n" ) == std::string::npos )
|
if( trimmed.find_first_of( "\r\n" ) == std::string::npos ) {
|
||||||
{
|
|
||||||
m_config.stream() << "[" << prefix << ": " << trimmed << "]\n";
|
m_config.stream() << "[" << prefix << ": " << trimmed << "]\n";
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
m_config.stream() << "\n[" << prefix << "] >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n" << trimmed
|
m_config.stream() << "\n[" << prefix << "] >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n" << trimmed
|
||||||
<< "\n[end of " << prefix << "] <<<<<<<<<<<<<<<<<<<<<<<<\n";
|
<< "\n[end of " << prefix << "] <<<<<<<<<<<<<<<<<<<<<<<<\n";
|
||||||
}
|
}
|
||||||
|
@ -1,13 +1,9 @@
|
|||||||
/*
|
/*
|
||||||
* catch_reporter_junit.hpp
|
|
||||||
* Catch
|
|
||||||
*
|
|
||||||
* Created by Phil on 26/11/2010.
|
* Created by Phil on 26/11/2010.
|
||||||
* Copyright 2010 Two Blue Cubes Ltd. All rights reserved.
|
* Copyright 2010 Two Blue Cubes Ltd. All rights reserved.
|
||||||
*
|
*
|
||||||
* Distributed under the Boost Software License, Version 1.0. (See accompanying
|
* Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||||
* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
#ifndef TWOBLUECUBES_CATCH_REPORTER_JUNIT_HPP_INCLUDED
|
#ifndef TWOBLUECUBES_CATCH_REPORTER_JUNIT_HPP_INCLUDED
|
||||||
#define TWOBLUECUBES_CATCH_REPORTER_JUNIT_HPP_INCLUDED
|
#define TWOBLUECUBES_CATCH_REPORTER_JUNIT_HPP_INCLUDED
|
||||||
@ -17,24 +13,20 @@
|
|||||||
#include "../internal/catch_reporter_registrars.hpp"
|
#include "../internal/catch_reporter_registrars.hpp"
|
||||||
#include "../internal/catch_xmlwriter.hpp"
|
#include "../internal/catch_xmlwriter.hpp"
|
||||||
|
|
||||||
namespace Catch
|
namespace Catch {
|
||||||
{
|
|
||||||
class JunitReporter : public SharedImpl<IReporter>
|
class JunitReporter : public SharedImpl<IReporter> {
|
||||||
{
|
|
||||||
struct TestStats
|
struct TestStats {
|
||||||
{
|
|
||||||
std::string m_element;
|
std::string m_element;
|
||||||
std::string m_resultType;
|
std::string m_resultType;
|
||||||
std::string m_message;
|
std::string m_message;
|
||||||
std::string m_content;
|
std::string m_content;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct TestCaseStats
|
struct TestCaseStats {
|
||||||
{
|
|
||||||
TestCaseStats( const std::string& name = std::string() )
|
TestCaseStats( const std::string& name = std::string() ) :m_name( name ){}
|
||||||
: m_name( name )
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
double m_timeInSeconds;
|
double m_timeInSeconds;
|
||||||
std::string m_status;
|
std::string m_status;
|
||||||
@ -43,8 +35,8 @@ namespace Catch
|
|||||||
std::vector<TestStats> m_testStats;
|
std::vector<TestStats> m_testStats;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Stats
|
struct Stats {
|
||||||
{
|
|
||||||
Stats( const std::string& name = std::string() )
|
Stats( const std::string& name = std::string() )
|
||||||
: m_testsCount( 0 ),
|
: m_testsCount( 0 ),
|
||||||
m_failuresCount( 0 ),
|
m_failuresCount( 0 ),
|
||||||
@ -52,8 +44,7 @@ namespace Catch
|
|||||||
m_errorsCount( 0 ),
|
m_errorsCount( 0 ),
|
||||||
m_timeInSeconds( 0 ),
|
m_timeInSeconds( 0 ),
|
||||||
m_name( name )
|
m_name( name )
|
||||||
{
|
{}
|
||||||
}
|
|
||||||
|
|
||||||
std::size_t m_testsCount;
|
std::size_t m_testsCount;
|
||||||
std::size_t m_failuresCount;
|
std::size_t m_failuresCount;
|
||||||
@ -66,83 +57,55 @@ namespace Catch
|
|||||||
};
|
};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
///////////////////////////////////////////////////////////////////////////
|
|
||||||
JunitReporter( const IReporterConfig& config )
|
JunitReporter( const IReporterConfig& config )
|
||||||
: m_config( config ),
|
: m_config( config ),
|
||||||
m_testSuiteStats( "AllTests" ),
|
m_testSuiteStats( "AllTests" ),
|
||||||
m_currentStats( &m_testSuiteStats )
|
m_currentStats( &m_testSuiteStats )
|
||||||
{
|
{}
|
||||||
}
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
static std::string getDescription() {
|
||||||
static std::string getDescription()
|
|
||||||
{
|
|
||||||
return "Reports test results in an XML format that looks like Ant's junitreport target";
|
return "Reports test results in an XML format that looks like Ant's junitreport target";
|
||||||
}
|
}
|
||||||
|
|
||||||
private: // IReporter
|
private: // IReporter
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
virtual bool shouldRedirectStdout() const {
|
||||||
virtual bool shouldRedirectStdout
|
|
||||||
()
|
|
||||||
const
|
|
||||||
{
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
virtual void StartTesting(){}
|
||||||
virtual void StartTesting()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
virtual void StartGroup( const std::string& groupName ) {
|
||||||
virtual void StartGroup( const std::string& groupName )
|
|
||||||
{
|
|
||||||
|
|
||||||
m_statsForSuites.push_back( Stats( groupName ) );
|
m_statsForSuites.push_back( Stats( groupName ) );
|
||||||
m_currentStats = &m_statsForSuites.back();
|
m_currentStats = &m_statsForSuites.back();
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
virtual void EndGroup( const std::string&, const Totals& totals ) {
|
||||||
virtual void EndGroup( const std::string&, const Totals& totals )
|
|
||||||
{
|
|
||||||
m_currentStats->m_testsCount = totals.assertions.total();
|
m_currentStats->m_testsCount = totals.assertions.total();
|
||||||
m_currentStats = &m_testSuiteStats;
|
m_currentStats = &m_testSuiteStats;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void StartSection( const std::string& /*sectionName*/, const std::string /*description*/ )
|
virtual void StartSection( const std::string&, const std::string& ){}
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual void EndSection( const std::string& /*sectionName*/, const Counts& /* assertions */ )
|
virtual void EndSection( const std::string&, const Counts& ){}
|
||||||
{
|
|
||||||
|
virtual void StartTestCase( const Catch::TestCaseInfo& testInfo ) {
|
||||||
|
m_currentStats->m_testCaseStats.push_back( TestCaseStats( testInfo.getName() ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
virtual void Result( const Catch::ResultInfo& resultInfo ) {
|
||||||
virtual void StartTestCase( const Catch::TestCaseInfo& testInfo )
|
if( resultInfo.getResultType() != ResultWas::Ok || m_config.includeSuccessfulResults() ) {
|
||||||
{
|
|
||||||
m_currentStats->m_testCaseStats.push_back( TestCaseStats( testInfo.getName() ) );
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
|
||||||
virtual void Result( const Catch::ResultInfo& resultInfo )
|
|
||||||
{
|
|
||||||
if( resultInfo.getResultType() != ResultWas::Ok || m_config.includeSuccessfulResults() )
|
|
||||||
{
|
|
||||||
TestCaseStats& testCaseStats = m_currentStats->m_testCaseStats.back();
|
TestCaseStats& testCaseStats = m_currentStats->m_testCaseStats.back();
|
||||||
TestStats stats;
|
TestStats stats;
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
if( !resultInfo.getMessage().empty() )
|
if( !resultInfo.getMessage().empty() )
|
||||||
{
|
|
||||||
oss << resultInfo.getMessage() << " at ";
|
oss << resultInfo.getMessage() << " at ";
|
||||||
}
|
|
||||||
oss << SourceLineInfo( resultInfo.getFilename(), resultInfo.getLine() );
|
oss << SourceLineInfo( resultInfo.getFilename(), resultInfo.getLine() );
|
||||||
stats.m_content = oss.str();
|
stats.m_content = oss.str();
|
||||||
stats.m_message = resultInfo.getExpandedExpression();
|
stats.m_message = resultInfo.getExpandedExpression();
|
||||||
stats.m_resultType = resultInfo.getTestMacroName();
|
stats.m_resultType = resultInfo.getTestMacroName();
|
||||||
switch( resultInfo.getResultType() )
|
|
||||||
{
|
switch( resultInfo.getResultType() ) {
|
||||||
case ResultWas::ThrewException:
|
case ResultWas::ThrewException:
|
||||||
stats.m_element = "error";
|
stats.m_element = "error";
|
||||||
m_currentStats->m_errorsCount++;
|
m_currentStats->m_errorsCount++;
|
||||||
@ -172,23 +135,18 @@ namespace Catch
|
|||||||
stats.m_element = "unknown";
|
stats.m_element = "unknown";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
testCaseStats.m_testStats.push_back( stats );
|
testCaseStats.m_testStats.push_back( stats );
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
virtual void EndTestCase( const Catch::TestCaseInfo&, const Totals&, const std::string& stdOut, const std::string& stdErr ) {
|
||||||
virtual void EndTestCase( const Catch::TestCaseInfo&, const Totals& /* totals */, const std::string& stdOut, const std::string& stdErr )
|
|
||||||
{
|
|
||||||
if( !stdOut.empty() )
|
if( !stdOut.empty() )
|
||||||
m_stdOut << stdOut << "\n";
|
m_stdOut << stdOut << "\n";
|
||||||
if( !stdErr.empty() )
|
if( !stdErr.empty() )
|
||||||
m_stdErr << stdErr << "\n";
|
m_stdErr << stdErr << "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
virtual void EndTesting( const Totals& ) {
|
||||||
virtual void EndTesting( const Totals& /* totals */ )
|
|
||||||
{
|
|
||||||
std::ostream& str = m_config.stream();
|
std::ostream& str = m_config.stream();
|
||||||
{
|
{
|
||||||
XmlWriter xml( str );
|
XmlWriter xml( str );
|
||||||
@ -199,8 +157,7 @@ namespace Catch
|
|||||||
std::vector<Stats>::const_iterator it = m_statsForSuites.begin();
|
std::vector<Stats>::const_iterator it = m_statsForSuites.begin();
|
||||||
std::vector<Stats>::const_iterator itEnd = m_statsForSuites.end();
|
std::vector<Stats>::const_iterator itEnd = m_statsForSuites.end();
|
||||||
|
|
||||||
for(; it != itEnd; ++it )
|
for(; it != itEnd; ++it ) {
|
||||||
{
|
|
||||||
XmlWriter::ScopedElement e = xml.scopedElement( "testsuite" );
|
XmlWriter::ScopedElement e = xml.scopedElement( "testsuite" );
|
||||||
xml.writeAttribute( "name", it->m_name );
|
xml.writeAttribute( "name", it->m_name );
|
||||||
xml.writeAttribute( "errors", it->m_errorsCount );
|
xml.writeAttribute( "errors", it->m_errorsCount );
|
||||||
@ -218,13 +175,10 @@ namespace Catch
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
void OutputTestCases( XmlWriter& xml, const Stats& stats ) {
|
||||||
void OutputTestCases( XmlWriter& xml, const Stats& stats )
|
|
||||||
{
|
|
||||||
std::vector<TestCaseStats>::const_iterator it = stats.m_testCaseStats.begin();
|
std::vector<TestCaseStats>::const_iterator it = stats.m_testCaseStats.begin();
|
||||||
std::vector<TestCaseStats>::const_iterator itEnd = stats.m_testCaseStats.end();
|
std::vector<TestCaseStats>::const_iterator itEnd = stats.m_testCaseStats.end();
|
||||||
for(; it != itEnd; ++it )
|
for(; it != itEnd; ++it ) {
|
||||||
{
|
|
||||||
xml.writeBlankLine();
|
xml.writeBlankLine();
|
||||||
xml.writeComment( "Test case" );
|
xml.writeComment( "Test case" );
|
||||||
|
|
||||||
@ -238,15 +192,11 @@ namespace Catch
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
void OutputTestResult( XmlWriter& xml, const TestCaseStats& stats ) {
|
||||||
void OutputTestResult( XmlWriter& xml, const TestCaseStats& stats )
|
|
||||||
{
|
|
||||||
std::vector<TestStats>::const_iterator it = stats.m_testStats.begin();
|
std::vector<TestStats>::const_iterator it = stats.m_testStats.begin();
|
||||||
std::vector<TestStats>::const_iterator itEnd = stats.m_testStats.end();
|
std::vector<TestStats>::const_iterator itEnd = stats.m_testStats.end();
|
||||||
for(; it != itEnd; ++it )
|
for(; it != itEnd; ++it ) {
|
||||||
{
|
if( it->m_element != "success" ) {
|
||||||
if( it->m_element != "success" )
|
|
||||||
{
|
|
||||||
XmlWriter::ScopedElement e = xml.scopedElement( it->m_element );
|
XmlWriter::ScopedElement e = xml.scopedElement( it->m_element );
|
||||||
|
|
||||||
xml.writeAttribute( "message", it->m_message );
|
xml.writeAttribute( "message", it->m_message );
|
||||||
|
@ -1,13 +1,9 @@
|
|||||||
/*
|
/*
|
||||||
* catch_reporter_xml.hpp
|
|
||||||
* Catch
|
|
||||||
*
|
|
||||||
* Created by Phil on 28/10/2010.
|
* Created by Phil on 28/10/2010.
|
||||||
* Copyright 2010 Two Blue Cubes Ltd. All rights reserved.
|
* Copyright 2010 Two Blue Cubes Ltd. All rights reserved.
|
||||||
*
|
*
|
||||||
* Distributed under the Boost Software License, Version 1.0. (See accompanying
|
* Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||||
* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
#ifndef TWOBLUECUBES_CATCH_REPORTER_XML_HPP_INCLUDED
|
#ifndef TWOBLUECUBES_CATCH_REPORTER_XML_HPP_INCLUDED
|
||||||
#define TWOBLUECUBES_CATCH_REPORTER_XML_HPP_INCLUDED
|
#define TWOBLUECUBES_CATCH_REPORTER_XML_HPP_INCLUDED
|
||||||
@ -17,114 +13,70 @@
|
|||||||
#include "../internal/catch_reporter_registrars.hpp"
|
#include "../internal/catch_reporter_registrars.hpp"
|
||||||
#include "../internal/catch_xmlwriter.hpp"
|
#include "../internal/catch_xmlwriter.hpp"
|
||||||
|
|
||||||
namespace Catch
|
namespace Catch {
|
||||||
{
|
class XmlReporter : public SharedImpl<IReporter> {
|
||||||
class XmlReporter : public SharedImpl<IReporter>
|
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
///////////////////////////////////////////////////////////////////////////
|
XmlReporter( const IReporterConfig& config ) : m_config( config ) {}
|
||||||
XmlReporter
|
|
||||||
(
|
|
||||||
const IReporterConfig& config
|
|
||||||
)
|
|
||||||
: m_config( config )
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
static std::string getDescription() {
|
||||||
static std::string getDescription
|
|
||||||
()
|
|
||||||
{
|
|
||||||
return "Reports test results as an XML document";
|
return "Reports test results as an XML document";
|
||||||
}
|
}
|
||||||
|
|
||||||
private: // IReporter
|
private: // IReporter
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
virtual bool shouldRedirectStdout() const {
|
||||||
virtual bool shouldRedirectStdout
|
|
||||||
()
|
|
||||||
const
|
|
||||||
{
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
virtual void StartTesting() {
|
||||||
virtual void StartTesting
|
|
||||||
()
|
|
||||||
{
|
|
||||||
m_xml = XmlWriter( m_config.stream() );
|
m_xml = XmlWriter( m_config.stream() );
|
||||||
m_xml.startElement( "Catch" );
|
m_xml.startElement( "Catch" );
|
||||||
if( !m_config.getName().empty() )
|
if( !m_config.getName().empty() )
|
||||||
m_xml.writeAttribute( "name", m_config.getName() );
|
m_xml.writeAttribute( "name", m_config.getName() );
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
virtual void EndTesting( const Totals& totals ) {
|
||||||
virtual void EndTesting
|
|
||||||
(
|
|
||||||
const Totals& totals
|
|
||||||
)
|
|
||||||
{
|
|
||||||
m_xml.scopedElement( "OverallResults" )
|
m_xml.scopedElement( "OverallResults" )
|
||||||
.writeAttribute( "successes", totals.assertions.passed )
|
.writeAttribute( "successes", totals.assertions.passed )
|
||||||
.writeAttribute( "failures", totals.assertions.failed );
|
.writeAttribute( "failures", totals.assertions.failed );
|
||||||
m_xml.endElement();
|
m_xml.endElement();
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
virtual void StartGroup( const std::string& groupName ) {
|
||||||
virtual void StartGroup
|
|
||||||
(
|
|
||||||
const std::string& groupName
|
|
||||||
)
|
|
||||||
{
|
|
||||||
m_xml.startElement( "Group" )
|
m_xml.startElement( "Group" )
|
||||||
.writeAttribute( "name", groupName );
|
.writeAttribute( "name", groupName );
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
virtual void EndGroup( const std::string&, const Totals& totals ) {
|
||||||
virtual void EndGroup
|
|
||||||
(
|
|
||||||
const std::string& /*groupName*/,
|
|
||||||
const Totals& totals
|
|
||||||
)
|
|
||||||
{
|
|
||||||
m_xml.scopedElement( "OverallResults" )
|
m_xml.scopedElement( "OverallResults" )
|
||||||
.writeAttribute( "successes", totals.assertions.passed )
|
.writeAttribute( "successes", totals.assertions.passed )
|
||||||
.writeAttribute( "failures", totals.assertions.failed );
|
.writeAttribute( "failures", totals.assertions.failed );
|
||||||
m_xml.endElement();
|
m_xml.endElement();
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
virtual void StartSection( const std::string& sectionName, const std::string& description ) {
|
||||||
virtual void StartSection( const std::string& sectionName, const std::string description )
|
|
||||||
{
|
|
||||||
m_xml.startElement( "Section" )
|
m_xml.startElement( "Section" )
|
||||||
.writeAttribute( "name", sectionName )
|
.writeAttribute( "name", sectionName )
|
||||||
.writeAttribute( "description", description );
|
.writeAttribute( "description", description );
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
virtual void EndSection( const std::string& /*sectionName*/, const Counts& assertions ) {
|
||||||
virtual void EndSection( const std::string& /*sectionName*/, const Counts& assertions )
|
|
||||||
{
|
|
||||||
m_xml.scopedElement( "OverallResults" )
|
m_xml.scopedElement( "OverallResults" )
|
||||||
.writeAttribute( "successes", assertions.passed )
|
.writeAttribute( "successes", assertions.passed )
|
||||||
.writeAttribute( "failures", assertions.failed );
|
.writeAttribute( "failures", assertions.failed );
|
||||||
m_xml.endElement();
|
m_xml.endElement();
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
virtual void StartTestCase( const Catch::TestCaseInfo& testInfo ) {
|
||||||
virtual void StartTestCase( const Catch::TestCaseInfo& testInfo )
|
|
||||||
{
|
|
||||||
m_xml.startElement( "TestCase" ).writeAttribute( "name", testInfo.getName() );
|
m_xml.startElement( "TestCase" ).writeAttribute( "name", testInfo.getName() );
|
||||||
m_currentTestSuccess = true;
|
m_currentTestSuccess = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
virtual void Result( const Catch::ResultInfo& resultInfo ) {
|
||||||
virtual void Result( const Catch::ResultInfo& resultInfo )
|
|
||||||
{
|
|
||||||
if( !m_config.includeSuccessfulResults() && resultInfo.getResultType() == ResultWas::Ok )
|
if( !m_config.includeSuccessfulResults() && resultInfo.getResultType() == ResultWas::Ok )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if( resultInfo.hasExpression() )
|
if( resultInfo.hasExpression() ) {
|
||||||
{
|
|
||||||
m_xml.startElement( "Expression" )
|
m_xml.startElement( "Expression" )
|
||||||
.writeAttribute( "success", resultInfo.ok() )
|
.writeAttribute( "success", resultInfo.ok() )
|
||||||
.writeAttribute( "filename", resultInfo.getFilename() )
|
.writeAttribute( "filename", resultInfo.getFilename() )
|
||||||
@ -137,8 +89,7 @@ namespace Catch
|
|||||||
m_currentTestSuccess &= resultInfo.ok();
|
m_currentTestSuccess &= resultInfo.ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
switch( resultInfo.getResultType() )
|
switch( resultInfo.getResultType() ) {
|
||||||
{
|
|
||||||
case ResultWas::ThrewException:
|
case ResultWas::ThrewException:
|
||||||
m_xml.scopedElement( "Exception" )
|
m_xml.scopedElement( "Exception" )
|
||||||
.writeAttribute( "filename", resultInfo.getFilename() )
|
.writeAttribute( "filename", resultInfo.getFilename() )
|
||||||
@ -172,9 +123,7 @@ namespace Catch
|
|||||||
m_xml.endElement();
|
m_xml.endElement();
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
virtual void EndTestCase( const Catch::TestCaseInfo&, const Totals&, const std::string&, const std::string& ) {
|
||||||
virtual void EndTestCase( const Catch::TestCaseInfo&, const Totals& /* totals */, const std::string& /*stdOut*/, const std::string& /*stdErr*/ )
|
|
||||||
{
|
|
||||||
m_xml.scopedElement( "OverallResult" ).writeAttribute( "success", m_currentTestSuccess );
|
m_xml.scopedElement( "OverallResult" ).writeAttribute( "success", m_currentTestSuccess );
|
||||||
m_xml.endElement();
|
m_xml.endElement();
|
||||||
}
|
}
|
||||||
|
@ -69,7 +69,7 @@ namespace Catch
|
|||||||
closeLabel( recordGroups, groupName );
|
closeLabel( recordGroups, groupName );
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void StartSection( const std::string& sectionName, const std::string description ) {
|
virtual void StartSection( const std::string& sectionName, const std::string& description ) {
|
||||||
openLabel( recordSections, sectionName );
|
openLabel( recordSections, sectionName );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user