mirror of
https://github.com/catchorg/Catch2.git
synced 2025-08-04 06:15:41 +02:00
Removed IRunner (rolled into IRunContext)
This commit is contained in:
@@ -14,7 +14,6 @@
|
||||
#include "catch_debugger.h"
|
||||
#include "catch_common.h"
|
||||
#include "catch_tostring.h"
|
||||
#include "catch_interfaces_runner.h"
|
||||
#include "catch_compiler_capabilities.h"
|
||||
|
||||
|
||||
|
@@ -19,7 +19,6 @@ namespace Catch {
|
||||
class TestCase;
|
||||
class Stream;
|
||||
struct IRunContext;
|
||||
struct IRunner;
|
||||
struct IConfig;
|
||||
|
||||
struct IContext
|
||||
@@ -27,7 +26,6 @@ namespace Catch {
|
||||
virtual ~IContext();
|
||||
|
||||
virtual IRunContext* getCurrentRunContext() = 0;
|
||||
virtual IRunner* getRunner() = 0;
|
||||
virtual IConfig const* getConfig() const = 0;
|
||||
};
|
||||
|
||||
@@ -35,7 +33,6 @@ namespace Catch {
|
||||
{
|
||||
virtual ~IMutableContext();
|
||||
virtual void setResultCapture( IRunContext* resultCapture ) = 0;
|
||||
virtual void setRunner( IRunner* runner ) = 0;
|
||||
virtual void setConfig( Ptr<IConfig const> const& config ) = 0;
|
||||
};
|
||||
|
||||
|
@@ -17,7 +17,7 @@ namespace Catch {
|
||||
|
||||
class Context : public IMutableContext {
|
||||
|
||||
Context() : m_config( CATCH_NULL ), m_runner( CATCH_NULL ), m_resultCapture( CATCH_NULL ) {}
|
||||
Context() : m_config( CATCH_NULL ), m_resultCapture( CATCH_NULL ) {}
|
||||
Context( Context const& );
|
||||
void operator=( Context const& );
|
||||
|
||||
@@ -25,9 +25,6 @@ namespace Catch {
|
||||
virtual IRunContext* getCurrentRunContext() {
|
||||
return m_resultCapture;
|
||||
}
|
||||
virtual IRunner* getRunner() {
|
||||
return m_runner;
|
||||
}
|
||||
virtual IConfig const* getConfig() const {
|
||||
return m_config.get();
|
||||
}
|
||||
@@ -36,9 +33,6 @@ namespace Catch {
|
||||
virtual void setResultCapture( IRunContext* resultCapture ) {
|
||||
m_resultCapture = resultCapture;
|
||||
}
|
||||
virtual void setRunner( IRunner* runner ) {
|
||||
m_runner = runner;
|
||||
}
|
||||
virtual void setConfig( Ptr<IConfig const> const& config ) {
|
||||
m_config = config;
|
||||
}
|
||||
@@ -47,7 +41,6 @@ namespace Catch {
|
||||
|
||||
private:
|
||||
Ptr<IConfig const> m_config;
|
||||
IRunner* m_runner;
|
||||
IRunContext* m_resultCapture;
|
||||
};
|
||||
|
||||
|
@@ -75,7 +75,6 @@ namespace Catch {
|
||||
StreamingReporterBase::~StreamingReporterBase() {}
|
||||
ConsoleReporter::~ConsoleReporter() {}
|
||||
CompactReporter::~CompactReporter() {}
|
||||
IRunner::~IRunner() {}
|
||||
IMutableContext::~IMutableContext() {}
|
||||
IConfig::~IConfig() {}
|
||||
XmlReporter::~XmlReporter() {}
|
||||
|
@@ -35,10 +35,11 @@ namespace Catch {
|
||||
virtual void pushScopedMessage( MessageInfo const& message ) = 0;
|
||||
virtual void popScopedMessage( MessageInfo const& message ) = 0;
|
||||
|
||||
virtual void handleFatalErrorCondition( std::string const& message ) = 0;
|
||||
|
||||
virtual std::string getCurrentTestName() const = 0;
|
||||
virtual const AssertionResult* getLastResult() const = 0;
|
||||
|
||||
virtual void handleFatalErrorCondition( std::string const& message ) = 0;
|
||||
virtual bool isAborting() const = 0;
|
||||
};
|
||||
|
||||
IRunContext& getCurrentRunContext();
|
||||
|
@@ -1,20 +0,0 @@
|
||||
/*
|
||||
* Created by Phil on 07/01/2011.
|
||||
* Copyright 2011 Two Blue Cubes Ltd. All rights reserved.
|
||||
*
|
||||
* 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)
|
||||
*/
|
||||
#ifndef TWOBLUECUBES_CATCH_INTERFACES_RUNNER_H_INCLUDED
|
||||
#define TWOBLUECUBES_CATCH_INTERFACES_RUNNER_H_INCLUDED
|
||||
|
||||
namespace Catch {
|
||||
class TestCase;
|
||||
|
||||
struct IRunner {
|
||||
virtual ~IRunner();
|
||||
virtual bool aborting() const = 0;
|
||||
};
|
||||
}
|
||||
|
||||
#endif // TWOBLUECUBES_CATCH_INTERFACES_RUNNER_H_INCLUDED
|
@@ -11,7 +11,6 @@
|
||||
#include "catch_result_builder.h"
|
||||
#include "catch_context.h"
|
||||
#include "catch_interfaces_config.h"
|
||||
#include "catch_interfaces_runner.h"
|
||||
#include "catch_interfaces_capture.h"
|
||||
#include "catch_interfaces_registry_hub.h"
|
||||
#include "catch_wildcard_pattern.hpp"
|
||||
@@ -103,7 +102,7 @@ namespace Catch {
|
||||
if( !result.isOk() ) {
|
||||
if( getCurrentConfig()->shouldDebugBreak() )
|
||||
m_shouldDebugBreak = true;
|
||||
if( getCurrentContext().getRunner()->aborting() || (m_assertionInfo.resultDisposition & ResultDisposition::Normal) )
|
||||
if( getCurrentContext().getCurrentRunContext()->isAborting() || (m_assertionInfo.resultDisposition & ResultDisposition::Normal) )
|
||||
m_shouldThrow = true;
|
||||
}
|
||||
}
|
||||
|
@@ -8,7 +8,6 @@
|
||||
#ifndef TWOBLUECUBES_CATCH_RUNNER_IMPL_HPP_INCLUDED
|
||||
#define TWOBLUECUBES_CATCH_RUNNER_IMPL_HPP_INCLUDED
|
||||
|
||||
#include "catch_interfaces_runner.h"
|
||||
#include "catch_interfaces_reporter.h"
|
||||
#include "catch_interfaces_exception.h"
|
||||
#include "catch_config.hpp"
|
||||
@@ -52,7 +51,7 @@ namespace Catch {
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
class RunContext : public IRunContext, public IRunner {
|
||||
class RunContext : public IRunContext {
|
||||
|
||||
RunContext( RunContext const& );
|
||||
void operator =( RunContext const& );
|
||||
@@ -66,21 +65,20 @@ namespace Catch {
|
||||
m_reporter( reporter ),
|
||||
m_activeTestCaseInfo( CATCH_NULL )
|
||||
{
|
||||
m_context.setRunner( this );
|
||||
m_context.setConfig( m_config );
|
||||
m_context.setResultCapture( this );
|
||||
m_reporter->testRunStarting( m_runInfo );
|
||||
}
|
||||
|
||||
virtual ~RunContext() {
|
||||
m_reporter->testRunEnded( TestRunStats( m_runInfo, m_totals, aborting() ) );
|
||||
m_reporter->testRunEnded( TestRunStats( m_runInfo, m_totals, isAborting() ) );
|
||||
}
|
||||
|
||||
void testGroupStarting( std::string const& testSpec, std::size_t groupIndex, std::size_t groupsCount ) {
|
||||
m_reporter->testGroupStarting( GroupInfo( testSpec, groupIndex, groupsCount ) );
|
||||
}
|
||||
void testGroupEnded( std::string const& testSpec, Totals const& totals, std::size_t groupIndex, std::size_t groupsCount ) {
|
||||
m_reporter->testGroupEnded( TestGroupStats( GroupInfo( testSpec, groupIndex, groupsCount ), totals, aborting() ) );
|
||||
m_reporter->testGroupEnded( TestGroupStats( GroupInfo( testSpec, groupIndex, groupsCount ), totals, isAborting() ) );
|
||||
}
|
||||
|
||||
Totals runTest( TestCase const& testCase ) {
|
||||
@@ -99,7 +97,7 @@ namespace Catch {
|
||||
m_testCaseTracker = &SectionTracker::acquire( m_trackerContext, testCase.name );
|
||||
runTest( testCase, redirectedCout, redirectedCerr );
|
||||
}
|
||||
while( !m_testCaseTracker->isSuccessfullyCompleted() && !aborting() );
|
||||
while( !m_testCaseTracker->isSuccessfullyCompleted() && !isAborting() );
|
||||
|
||||
|
||||
Totals deltaTotals = m_totals.delta( prevTotals );
|
||||
@@ -108,7 +106,7 @@ namespace Catch {
|
||||
deltaTotals,
|
||||
redirectedCout,
|
||||
redirectedCerr,
|
||||
aborting() ) );
|
||||
isAborting() ) );
|
||||
|
||||
m_activeTestCaseInfo = CATCH_NULL;
|
||||
|
||||
@@ -243,7 +241,7 @@ namespace Catch {
|
||||
|
||||
public:
|
||||
// !TBD We need to do this another way!
|
||||
bool aborting() const {
|
||||
bool isAborting() const {
|
||||
return m_totals.assertions.failed == static_cast<std::size_t>( m_config->abortAfter() );
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user