mirror of
https://github.com/catchorg/Catch2.git
synced 2025-08-01 12:55:40 +02:00
Refactoring towards interface based config
This commit is contained in:
@@ -160,7 +160,7 @@ namespace Catch {
|
||||
}
|
||||
|
||||
virtual void Result( const AssertionResult& assertionResult ) {
|
||||
if( !m_config.includeSuccessfulResults() && assertionResult.getResultType() == ResultWas::Ok )
|
||||
if( !m_config.fullConfig()->includeSuccessfulResults() && assertionResult.getResultType() == ResultWas::Ok )
|
||||
return;
|
||||
|
||||
startSpansLazily();
|
||||
@@ -289,10 +289,10 @@ namespace Catch {
|
||||
|
||||
void startSpansLazily() {
|
||||
if( !m_testingSpan.emitted ) {
|
||||
if( m_config.name().empty() )
|
||||
if( m_config.fullConfig()->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.fullConfig()->name() << "]" << std::endl;
|
||||
m_testingSpan.emitted = true;
|
||||
}
|
||||
|
||||
|
@@ -43,7 +43,7 @@ namespace Catch {
|
||||
AssertionResult const& result = _assertionStats.assertionResult;
|
||||
|
||||
// Drop out if result was successful and we're not printing those
|
||||
if( !m_config.includeSuccessfulResults() && result.isOk() )
|
||||
if( !m_config->includeSuccessfulResults() && result.isOk() )
|
||||
return;
|
||||
|
||||
lazyPrint();
|
||||
|
@@ -65,7 +65,7 @@ namespace Catch {
|
||||
};
|
||||
|
||||
public:
|
||||
JunitReporter( const ReporterConfig& config )
|
||||
JunitReporter( ReporterConfig const& config )
|
||||
: m_config( config ),
|
||||
m_testSuiteStats( "AllTests" ),
|
||||
m_currentStats( &m_testSuiteStats )
|
||||
@@ -86,7 +86,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.fullConfig()->name() ) );
|
||||
else
|
||||
m_statsForSuites.push_back( Stats( groupName ) );
|
||||
m_currentStats = &m_statsForSuites.back();
|
||||
@@ -110,7 +110,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.fullConfig()->includeSuccessfulResults() ) {
|
||||
TestCaseStats& testCaseStats = m_currentStats->m_testCaseStats.back();
|
||||
TestStats stats;
|
||||
std::ostringstream oss;
|
||||
@@ -238,7 +238,6 @@ namespace Catch {
|
||||
|
||||
private:
|
||||
ReporterConfig m_config;
|
||||
// bool m_currentTestSuccess;
|
||||
|
||||
Stats m_testSuiteStats;
|
||||
Stats* m_currentStats;
|
||||
|
@@ -16,7 +16,7 @@
|
||||
namespace Catch {
|
||||
class XmlReporter : public SharedImpl<IReporter> {
|
||||
public:
|
||||
XmlReporter( const ReporterConfig& config ) : m_config( config ) {}
|
||||
XmlReporter( ReporterConfig const& config ) : m_config( config ) {}
|
||||
|
||||
static std::string getDescription() {
|
||||
return "Reports test results as an XML document";
|
||||
@@ -32,8 +32,8 @@ namespace Catch {
|
||||
virtual void StartTesting() {
|
||||
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.fullConfig()->name().empty() )
|
||||
m_xml.writeAttribute( "name", m_config.fullConfig()->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.fullConfig()->includeSuccessfulResults() && assertionResult.getResultType() == ResultWas::Ok )
|
||||
return;
|
||||
|
||||
if( assertionResult.hasExpression() ) {
|
||||
|
Reference in New Issue
Block a user