diff --git a/include/internal/catch_capture.hpp b/include/internal/catch_capture.hpp index 3d23206e..e819c63d 100644 --- a/include/internal/catch_capture.hpp +++ b/include/internal/catch_capture.hpp @@ -10,12 +10,14 @@ #include "catch_result_builder.h" #include "catch_message.h" -#include "catch_interfaces_capture.h" #include "catch_debugger.h" #include "catch_common.h" #include "catch_tostring.h" #include "catch_compiler_capabilities.h" +namespace Catch { + AssertionResult const* getLastResult(); +} /////////////////////////////////////////////////////////////////////////////// // In the event of a failure works out if the debugger needs to be invoked @@ -43,12 +45,12 @@ /////////////////////////////////////////////////////////////////////////////// #define INTERNAL_CATCH_IF( expr, resultDisposition, macroName ) \ INTERNAL_CATCH_TEST( expr, resultDisposition, macroName ); \ - if( Catch::getCurrentRunContext().getLastResult()->succeeded() ) + if( Catch::getLastResult()->succeeded() ) /////////////////////////////////////////////////////////////////////////////// #define INTERNAL_CATCH_ELSE( expr, resultDisposition, macroName ) \ INTERNAL_CATCH_TEST( expr, resultDisposition, macroName ); \ - if( !Catch::getCurrentRunContext().getLastResult()->succeeded() ) + if( !Catch::getLastResult()->succeeded() ) /////////////////////////////////////////////////////////////////////////////// #define INTERNAL_CATCH_NO_THROW( expr, resultDisposition, macroName ) \ diff --git a/include/internal/catch_interfaces_capture.h b/include/internal/catch_interfaces_capture.h index 6f0a4716..39a5ae0a 100644 --- a/include/internal/catch_interfaces_capture.h +++ b/include/internal/catch_interfaces_capture.h @@ -40,7 +40,7 @@ namespace Catch { virtual void handleFatalErrorCondition( std::string const& message ) = 0; virtual std::string getCurrentTestName() const = 0; - virtual const AssertionResult* getLastResult() const = 0; + virtual AssertionResult const* getLastResult() const = 0; virtual bool isAborting() const = 0; virtual IConfig const& config() const = 0; }; diff --git a/include/internal/catch_run_context.hpp b/include/internal/catch_run_context.hpp index 1eebf2c9..80fc8313 100644 --- a/include/internal/catch_run_context.hpp +++ b/include/internal/catch_run_context.hpp @@ -8,6 +8,7 @@ #ifndef TWOBLUECUBES_CATCH_RUNNER_IMPL_HPP_INCLUDED #define TWOBLUECUBES_CATCH_RUNNER_IMPL_HPP_INCLUDED +#include "catch_interfaces_capture.h" #include "catch_interfaces_reporter.h" #include "catch_interfaces_exception.h" #include "catch_config.hpp" @@ -75,6 +76,9 @@ namespace Catch { else return CATCH_NULL; } + AssertionResult const* getLastResult() { + return getCurrentRunContext().getLastResult(); + } class RunContext : public IRunContext { @@ -223,7 +227,7 @@ namespace Catch { : ""; } - virtual const AssertionResult* getLastResult() const CATCH_OVERRIDE { + virtual AssertionResult const* getLastResult() const CATCH_OVERRIDE { return &m_lastResult; } virtual IConfig const& config() const CATCH_OVERRIDE {