From 73968f29a520ada2f553707c44fc03f552ca43dc Mon Sep 17 00:00:00 2001 From: Phil Nash Date: Thu, 19 Nov 2015 17:45:56 +0000 Subject: [PATCH] ResultCapture -> RunContext --- include/internal/catch_capture.hpp | 4 ++-- include/internal/catch_context.h | 6 +++--- include/internal/catch_context_impl.hpp | 6 +++--- include/internal/catch_fatal_condition.hpp | 4 ++-- include/internal/catch_impl.hpp | 2 +- include/internal/catch_interfaces_capture.h | 6 +++--- include/internal/catch_message.hpp | 4 ++-- include/internal/catch_result_builder.hpp | 2 +- include/internal/catch_run_context.hpp | 8 ++++---- include/internal/catch_section.hpp | 6 +++--- 10 files changed, 24 insertions(+), 24 deletions(-) diff --git a/include/internal/catch_capture.hpp b/include/internal/catch_capture.hpp index 22cf6959..fe634452 100644 --- a/include/internal/catch_capture.hpp +++ b/include/internal/catch_capture.hpp @@ -44,12 +44,12 @@ /////////////////////////////////////////////////////////////////////////////// #define INTERNAL_CATCH_IF( expr, resultDisposition, macroName ) \ INTERNAL_CATCH_TEST( expr, resultDisposition, macroName ); \ - if( Catch::getResultCapture().getLastResult()->succeeded() ) + if( Catch::getCurrentRunContext().getLastResult()->succeeded() ) /////////////////////////////////////////////////////////////////////////////// #define INTERNAL_CATCH_ELSE( expr, resultDisposition, macroName ) \ INTERNAL_CATCH_TEST( expr, resultDisposition, macroName ); \ - if( !Catch::getResultCapture().getLastResult()->succeeded() ) + if( !Catch::getCurrentRunContext().getLastResult()->succeeded() ) /////////////////////////////////////////////////////////////////////////////// #define INTERNAL_CATCH_NO_THROW( expr, resultDisposition, macroName ) \ diff --git a/include/internal/catch_context.h b/include/internal/catch_context.h index 64232b9e..75f9df54 100644 --- a/include/internal/catch_context.h +++ b/include/internal/catch_context.h @@ -18,7 +18,7 @@ namespace Catch { class TestCase; class Stream; - struct IResultCapture; + struct IRunContext; struct IRunner; struct IConfig; @@ -26,7 +26,7 @@ namespace Catch { { virtual ~IContext(); - virtual IResultCapture* getResultCapture() = 0; + virtual IRunContext* getCurrentRunContext() = 0; virtual IRunner* getRunner() = 0; virtual IConfig const* getConfig() const = 0; }; @@ -34,7 +34,7 @@ namespace Catch { struct IMutableContext : IContext { virtual ~IMutableContext(); - virtual void setResultCapture( IResultCapture* resultCapture ) = 0; + virtual void setResultCapture( IRunContext* resultCapture ) = 0; virtual void setRunner( IRunner* runner ) = 0; virtual void setConfig( Ptr const& config ) = 0; }; diff --git a/include/internal/catch_context_impl.hpp b/include/internal/catch_context_impl.hpp index b2cb640d..cbf8758e 100644 --- a/include/internal/catch_context_impl.hpp +++ b/include/internal/catch_context_impl.hpp @@ -22,7 +22,7 @@ namespace Catch { void operator=( Context const& ); public: // IContext - virtual IResultCapture* getResultCapture() { + virtual IRunContext* getCurrentRunContext() { return m_resultCapture; } virtual IRunner* getRunner() { @@ -33,7 +33,7 @@ namespace Catch { } public: // IMutableContext - virtual void setResultCapture( IResultCapture* resultCapture ) { + virtual void setResultCapture( IRunContext* resultCapture ) { m_resultCapture = resultCapture; } virtual void setRunner( IRunner* runner ) { @@ -48,7 +48,7 @@ namespace Catch { private: Ptr m_config; IRunner* m_runner; - IResultCapture* m_resultCapture; + IRunContext* m_resultCapture; }; namespace { diff --git a/include/internal/catch_fatal_condition.hpp b/include/internal/catch_fatal_condition.hpp index dd21d590..36e6862d 100644 --- a/include/internal/catch_fatal_condition.hpp +++ b/include/internal/catch_fatal_condition.hpp @@ -15,8 +15,8 @@ namespace Catch { // Report the error condition then exit the process inline void fatal( std::string const& message, int exitCode ) { IContext& context = Catch::getCurrentContext(); - IResultCapture* resultCapture = context.getResultCapture(); - resultCapture->handleFatalErrorCondition( message ); + IRunContext* runContext = context.getCurrentRunContext(); + runContext->handleFatalErrorCondition( message ); if( Catch::alwaysTrue() ) // avoids "no return" warnings exit( exitCode ); diff --git a/include/internal/catch_impl.hpp b/include/internal/catch_impl.hpp index afb244e2..925f9554 100644 --- a/include/internal/catch_impl.hpp +++ b/include/internal/catch_impl.hpp @@ -53,7 +53,7 @@ namespace Catch { DebugOutStream::~DebugOutStream() CATCH_NOEXCEPT {} StreamBufBase::~StreamBufBase() CATCH_NOEXCEPT {} IContext::~IContext() {} - IResultCapture::~IResultCapture() {} + IRunContext::~IRunContext() {} ITestCase::~ITestCase() {} ITestCaseRegistry::~ITestCaseRegistry() {} IRegistryHub::~IRegistryHub() {} diff --git a/include/internal/catch_interfaces_capture.h b/include/internal/catch_interfaces_capture.h index b7b6e32d..515b9f68 100644 --- a/include/internal/catch_interfaces_capture.h +++ b/include/internal/catch_interfaces_capture.h @@ -23,9 +23,9 @@ namespace Catch { class ScopedMessageBuilder; struct Counts; - struct IResultCapture { + struct IRunContext { - virtual ~IResultCapture(); + virtual ~IRunContext(); virtual void assertionEnded( AssertionResult const& result ) = 0; virtual bool sectionStarted( SectionInfo const& sectionInfo, @@ -41,7 +41,7 @@ namespace Catch { virtual void handleFatalErrorCondition( std::string const& message ) = 0; }; - IResultCapture& getResultCapture(); + IRunContext& getCurrentRunContext(); } #endif // TWOBLUECUBES_CATCH_INTERFACES_CAPTURE_H_INCLUDED diff --git a/include/internal/catch_message.hpp b/include/internal/catch_message.hpp index 42866be8..633fa5b3 100644 --- a/include/internal/catch_message.hpp +++ b/include/internal/catch_message.hpp @@ -31,14 +31,14 @@ namespace Catch { : m_info( builder.m_info ) { m_info.message = builder.m_stream.str(); - getResultCapture().pushScopedMessage( m_info ); + getCurrentRunContext().pushScopedMessage( m_info ); } ScopedMessage::ScopedMessage( ScopedMessage const& other ) : m_info( other.m_info ) {} ScopedMessage::~ScopedMessage() { - getResultCapture().popScopedMessage( m_info ); + getCurrentRunContext().popScopedMessage( m_info ); } diff --git a/include/internal/catch_result_builder.hpp b/include/internal/catch_result_builder.hpp index c0c04c9f..429e8bd9 100644 --- a/include/internal/catch_result_builder.hpp +++ b/include/internal/catch_result_builder.hpp @@ -98,7 +98,7 @@ namespace Catch { } void ResultBuilder::handleResult( AssertionResult const& result ) { - getResultCapture().assertionEnded( result ); + getCurrentRunContext().assertionEnded( result ); if( !result.isOk() ) { if( getCurrentConfig()->shouldDebugBreak() ) diff --git a/include/internal/catch_run_context.hpp b/include/internal/catch_run_context.hpp index 77f84cdf..ed334ae8 100644 --- a/include/internal/catch_run_context.hpp +++ b/include/internal/catch_run_context.hpp @@ -52,7 +52,7 @@ namespace Catch { /////////////////////////////////////////////////////////////////////////// - class RunContext : public IResultCapture, public IRunner { + class RunContext : public IRunContext, public IRunner { RunContext( RunContext const& ); void operator =( RunContext const& ); @@ -119,7 +119,7 @@ namespace Catch { return m_config; } - private: // IResultCapture + private: // IRunContext virtual void assertionEnded( AssertionResult const& result ) { @@ -337,8 +337,8 @@ namespace Catch { std::vector m_messages; }; - IResultCapture& getResultCapture() { - if( IResultCapture* capture = getCurrentContext().getResultCapture() ) + IRunContext& getCurrentRunContext() { + if( IRunContext* capture = getCurrentContext().getCurrentRunContext() ) return *capture; else throw std::logic_error( "No result capture instance" ); diff --git a/include/internal/catch_section.hpp b/include/internal/catch_section.hpp index de65c4cd..f921b6a2 100644 --- a/include/internal/catch_section.hpp +++ b/include/internal/catch_section.hpp @@ -26,7 +26,7 @@ namespace Catch { Section::Section( SectionInfo const& info ) : m_info( info ), - m_sectionIncluded( getResultCapture().sectionStarted( m_info, m_assertions ) ) + m_sectionIncluded( getCurrentRunContext().sectionStarted( m_info, m_assertions ) ) { m_timer.start(); } @@ -35,9 +35,9 @@ namespace Catch { if( m_sectionIncluded ) { SectionEndInfo endInfo( m_info, m_assertions, m_timer.getElapsedSeconds() ); if( std::uncaught_exception() ) - getResultCapture().sectionEndedEarly( endInfo ); + getCurrentRunContext().sectionEndedEarly( endInfo ); else - getResultCapture().sectionEnded( endInfo ); + getCurrentRunContext().sectionEnded( endInfo ); } }