Removed IRunner (rolled into IRunContext)

This commit is contained in:
Phil Nash 2015-11-19 17:53:21 +00:00
parent 73968f29a5
commit eea9357284
12 changed files with 12 additions and 54 deletions

View File

@ -42,7 +42,6 @@
// These files are included here so the single_include script doesn't put them
// in the conditionally compiled sections
#include "internal/catch_test_case_info.h"
#include "internal/catch_interfaces_runner.h"
#ifdef __OBJC__
#include "internal/catch_objc.hpp"

View File

@ -74,7 +74,7 @@ namespace Catch {
for( std::vector<TestCase>::const_iterator it = allTestCases.begin(), itEnd = allTestCases.end();
it != itEnd;
++it ) {
if( !context.aborting() && matchTest( *it, testSpec, *iconfig ) )
if( !context.isAborting() && matchTest( *it, testSpec, *iconfig ) )
totals += context.runTest( *it );
else
reporter->skipTest( *it );

View File

@ -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"

View File

@ -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;
};

View File

@ -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;
};

View File

@ -75,7 +75,6 @@ namespace Catch {
StreamingReporterBase::~StreamingReporterBase() {}
ConsoleReporter::~ConsoleReporter() {}
CompactReporter::~CompactReporter() {}
IRunner::~IRunner() {}
IMutableContext::~IMutableContext() {}
IConfig::~IConfig() {}
XmlReporter::~XmlReporter() {}

View File

@ -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();

View File

@ -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

View File

@ -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;
}
}

View File

@ -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() );
}

View File

@ -1 +0,0 @@
#include "catch_interfaces_runner.h"

View File

@ -27,7 +27,6 @@
4A45DA2D16161FA2004F8D6B /* catch_interfaces_capture.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4A45DA2C16161FA2004F8D6B /* catch_interfaces_capture.cpp */; };
4A45DA3116161FFC004F8D6B /* catch_interfaces_reporter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4A45DA3016161FFB004F8D6B /* catch_interfaces_reporter.cpp */; };
4A45DA3316162047004F8D6B /* catch_interfaces_exception.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4A45DA3216162047004F8D6B /* catch_interfaces_exception.cpp */; };
4A45DA3516162071004F8D6B /* catch_interfaces_runner.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4A45DA3416162071004F8D6B /* catch_interfaces_runner.cpp */; };
4A6D0C27149B3D3B00DB3EAA /* CatchSelfTest.1 in CopyFiles */ = {isa = PBXBuildFile; fileRef = 4A6D0C26149B3D3B00DB3EAA /* CatchSelfTest.1 */; };
4A6D0C37149B3D9E00DB3EAA /* ApproxTests.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4A6D0C2D149B3D9E00DB3EAA /* ApproxTests.cpp */; };
4A6D0C38149B3D9E00DB3EAA /* ClassTests.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4A6D0C2F149B3D9E00DB3EAA /* ClassTests.cpp */; };
@ -120,7 +119,6 @@
4A45DA2C16161FA2004F8D6B /* catch_interfaces_capture.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = catch_interfaces_capture.cpp; path = ../../../SelfTest/SurrogateCpps/catch_interfaces_capture.cpp; sourceTree = "<group>"; };
4A45DA3016161FFB004F8D6B /* catch_interfaces_reporter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = catch_interfaces_reporter.cpp; path = ../../../SelfTest/SurrogateCpps/catch_interfaces_reporter.cpp; sourceTree = "<group>"; };
4A45DA3216162047004F8D6B /* catch_interfaces_exception.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = catch_interfaces_exception.cpp; path = ../../../SelfTest/SurrogateCpps/catch_interfaces_exception.cpp; sourceTree = "<group>"; };
4A45DA3416162071004F8D6B /* catch_interfaces_runner.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = catch_interfaces_runner.cpp; path = ../../../SelfTest/SurrogateCpps/catch_interfaces_runner.cpp; sourceTree = "<group>"; };
4A4B0F9715CE6CFB00AE2392 /* catch_registry_hub.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; lineEnding = 0; path = catch_registry_hub.hpp; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.cpp; };
4A4B0F9915CE6EC100AE2392 /* catch_interfaces_registry_hub.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = catch_interfaces_registry_hub.h; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
4A4B0F9A15CEF84800AE2392 /* catch_notimplemented_exception.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = catch_notimplemented_exception.h; sourceTree = "<group>"; };
@ -154,7 +152,6 @@
4A6D0C53149B3E3D00DB3EAA /* catch_interfaces_capture.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = catch_interfaces_capture.h; sourceTree = "<group>"; };
4A6D0C54149B3E3D00DB3EAA /* catch_interfaces_exception.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = catch_interfaces_exception.h; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
4A6D0C55149B3E3D00DB3EAA /* catch_interfaces_reporter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = catch_interfaces_reporter.h; sourceTree = "<group>"; };
4A6D0C56149B3E3D00DB3EAA /* catch_interfaces_runner.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = catch_interfaces_runner.h; sourceTree = "<group>"; };
4A6D0C57149B3E3D00DB3EAA /* catch_interfaces_testcase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = catch_interfaces_testcase.h; sourceTree = "<group>"; };
4A6D0C58149B3E3D00DB3EAA /* catch_list.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; lineEnding = 0; path = catch_list.hpp; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.cpp; };
4A6D0C59149B3E3D00DB3EAA /* catch_objc.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = catch_objc.hpp; sourceTree = "<group>"; };
@ -337,7 +334,6 @@
4A45DA2C16161FA2004F8D6B /* catch_interfaces_capture.cpp */,
4A45DA3216162047004F8D6B /* catch_interfaces_exception.cpp */,
4A45DA3016161FFB004F8D6B /* catch_interfaces_reporter.cpp */,
4A45DA3416162071004F8D6B /* catch_interfaces_runner.cpp */,
4AB3D99C1616216500C9A0F8 /* catch_interfaces_testcase.cpp */,
4AB3D99F1616219100C9A0F8 /* catch_interfaces_config.cpp */,
4AB3D9A1161621B500C9A0F8 /* catch_interfaces_generators.cpp */,
@ -435,7 +431,6 @@
4A6D0C53149B3E3D00DB3EAA /* catch_interfaces_capture.h */,
4A6D0C54149B3E3D00DB3EAA /* catch_interfaces_exception.h */,
4A6D0C55149B3E3D00DB3EAA /* catch_interfaces_reporter.h */,
4A6D0C56149B3E3D00DB3EAA /* catch_interfaces_runner.h */,
4A6D0C57149B3E3D00DB3EAA /* catch_interfaces_testcase.h */,
4AFC661D157E96A7009D58CF /* catch_interfaces_config.h */,
26711C90195D46CD0033EDA2 /* catch_interfaces_tag_alias_registry.h */,
@ -560,7 +555,6 @@
4A45DA3316162047004F8D6B /* catch_interfaces_exception.cpp in Sources */,
2691574C1A532A280054F1ED /* ToStringTuple.cpp in Sources */,
26711C8F195D465C0033EDA2 /* TagAliasTests.cpp in Sources */,
4A45DA3516162071004F8D6B /* catch_interfaces_runner.cpp in Sources */,
4AB3D99D1616216500C9A0F8 /* catch_interfaces_testcase.cpp in Sources */,
4AB3D9A01616219100C9A0F8 /* catch_interfaces_config.cpp in Sources */,
4AB3D9A2161621B500C9A0F8 /* catch_interfaces_generators.cpp in Sources */,