catch_capture.hpp doesn't need to depend on catch_interfaces_capture.h

This commit is contained in:
Phil Nash 2015-11-19 18:37:39 +00:00
parent fdc8a2b2df
commit 6789dfa2ba
3 changed files with 11 additions and 5 deletions

View File

@ -10,12 +10,14 @@
#include "catch_result_builder.h" #include "catch_result_builder.h"
#include "catch_message.h" #include "catch_message.h"
#include "catch_interfaces_capture.h"
#include "catch_debugger.h" #include "catch_debugger.h"
#include "catch_common.h" #include "catch_common.h"
#include "catch_tostring.h" #include "catch_tostring.h"
#include "catch_compiler_capabilities.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 // 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 ) \ #define INTERNAL_CATCH_IF( expr, resultDisposition, macroName ) \
INTERNAL_CATCH_TEST( 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 ) \ #define INTERNAL_CATCH_ELSE( expr, resultDisposition, macroName ) \
INTERNAL_CATCH_TEST( 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 ) \ #define INTERNAL_CATCH_NO_THROW( expr, resultDisposition, macroName ) \

View File

@ -40,7 +40,7 @@ namespace Catch {
virtual void handleFatalErrorCondition( std::string const& message ) = 0; virtual void handleFatalErrorCondition( std::string const& message ) = 0;
virtual std::string getCurrentTestName() const = 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 bool isAborting() const = 0;
virtual IConfig const& config() const = 0; virtual IConfig const& config() const = 0;
}; };

View File

@ -8,6 +8,7 @@
#ifndef TWOBLUECUBES_CATCH_RUNNER_IMPL_HPP_INCLUDED #ifndef TWOBLUECUBES_CATCH_RUNNER_IMPL_HPP_INCLUDED
#define 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_reporter.h"
#include "catch_interfaces_exception.h" #include "catch_interfaces_exception.h"
#include "catch_config.hpp" #include "catch_config.hpp"
@ -75,6 +76,9 @@ namespace Catch {
else else
return CATCH_NULL; return CATCH_NULL;
} }
AssertionResult const* getLastResult() {
return getCurrentRunContext().getLastResult();
}
class RunContext : public IRunContext { 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; return &m_lastResult;
} }
virtual IConfig const& config() const CATCH_OVERRIDE { virtual IConfig const& config() const CATCH_OVERRIDE {