mirror of
https://github.com/catchorg/Catch2.git
synced 2024-11-17 11:12:25 +01:00
Funnel most calls to getCurrentRunContext() through C_A_T_C_H_Context()
This commit is contained in:
parent
f4ba8aaf19
commit
ebb4677089
@ -15,9 +15,6 @@
|
|||||||
#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
|
||||||
@ -32,7 +29,7 @@ namespace Catch {
|
|||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
#define INTERNAL_CATCH_TEST( expr, resultDisposition, macroName ) \
|
#define INTERNAL_CATCH_TEST( expr, resultDisposition, macroName ) \
|
||||||
do { \
|
do { \
|
||||||
Catch::ResultBuilder __catchResult( macroName, CATCH_INTERNAL_LINEINFO, #expr, resultDisposition ); \
|
Catch::ResultBuilder __catchResult( C_A_T_C_H_Context(), macroName, CATCH_INTERNAL_LINEINFO, #expr, resultDisposition ); \
|
||||||
try { \
|
try { \
|
||||||
( __catchResult <= expr ).endExpression(); \
|
( __catchResult <= expr ).endExpression(); \
|
||||||
} \
|
} \
|
||||||
@ -45,17 +42,17 @@ namespace Catch {
|
|||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
#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::getLastResult()->succeeded() )
|
if( C_A_T_C_H_Context().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::getLastResult()->succeeded() )
|
if( !C_A_T_C_H_Context().getLastResult()->succeeded() )
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
#define INTERNAL_CATCH_NO_THROW( expr, resultDisposition, macroName ) \
|
#define INTERNAL_CATCH_NO_THROW( expr, resultDisposition, macroName ) \
|
||||||
do { \
|
do { \
|
||||||
Catch::ResultBuilder __catchResult( macroName, CATCH_INTERNAL_LINEINFO, #expr, resultDisposition ); \
|
Catch::ResultBuilder __catchResult( C_A_T_C_H_Context(), macroName, CATCH_INTERNAL_LINEINFO, #expr, resultDisposition ); \
|
||||||
try { \
|
try { \
|
||||||
expr; \
|
expr; \
|
||||||
__catchResult.captureResult( Catch::ResultWas::Ok ); \
|
__catchResult.captureResult( Catch::ResultWas::Ok ); \
|
||||||
@ -69,7 +66,7 @@ namespace Catch {
|
|||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
#define INTERNAL_CATCH_THROWS( expr, resultDisposition, matcher, macroName ) \
|
#define INTERNAL_CATCH_THROWS( expr, resultDisposition, matcher, macroName ) \
|
||||||
do { \
|
do { \
|
||||||
Catch::ResultBuilder __catchResult( macroName, CATCH_INTERNAL_LINEINFO, #expr, resultDisposition, #matcher ); \
|
Catch::ResultBuilder __catchResult( C_A_T_C_H_Context(), macroName, CATCH_INTERNAL_LINEINFO, #expr, resultDisposition, #matcher ); \
|
||||||
if( __catchResult.allowThrows() ) \
|
if( __catchResult.allowThrows() ) \
|
||||||
try { \
|
try { \
|
||||||
expr; \
|
expr; \
|
||||||
@ -86,7 +83,7 @@ namespace Catch {
|
|||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
#define INTERNAL_CATCH_THROWS_AS( expr, exceptionType, resultDisposition, macroName ) \
|
#define INTERNAL_CATCH_THROWS_AS( expr, exceptionType, resultDisposition, macroName ) \
|
||||||
do { \
|
do { \
|
||||||
Catch::ResultBuilder __catchResult( macroName, CATCH_INTERNAL_LINEINFO, #expr, resultDisposition ); \
|
Catch::ResultBuilder __catchResult( C_A_T_C_H_Context(), macroName, CATCH_INTERNAL_LINEINFO, #expr, resultDisposition ); \
|
||||||
if( __catchResult.allowThrows() ) \
|
if( __catchResult.allowThrows() ) \
|
||||||
try { \
|
try { \
|
||||||
expr; \
|
expr; \
|
||||||
@ -108,7 +105,7 @@ namespace Catch {
|
|||||||
#ifdef CATCH_CONFIG_VARIADIC_MACROS
|
#ifdef CATCH_CONFIG_VARIADIC_MACROS
|
||||||
#define INTERNAL_CATCH_MSG( messageType, resultDisposition, macroName, ... ) \
|
#define INTERNAL_CATCH_MSG( messageType, resultDisposition, macroName, ... ) \
|
||||||
do { \
|
do { \
|
||||||
Catch::ResultBuilder __catchResult( macroName, CATCH_INTERNAL_LINEINFO, "", resultDisposition ); \
|
Catch::ResultBuilder __catchResult( C_A_T_C_H_Context(), macroName, CATCH_INTERNAL_LINEINFO, "", resultDisposition ); \
|
||||||
__catchResult << __VA_ARGS__ + ::Catch::StreamEndStop(); \
|
__catchResult << __VA_ARGS__ + ::Catch::StreamEndStop(); \
|
||||||
__catchResult.captureResult( messageType ); \
|
__catchResult.captureResult( messageType ); \
|
||||||
INTERNAL_CATCH_REACT( __catchResult ) \
|
INTERNAL_CATCH_REACT( __catchResult ) \
|
||||||
@ -116,7 +113,7 @@ namespace Catch {
|
|||||||
#else
|
#else
|
||||||
#define INTERNAL_CATCH_MSG( messageType, resultDisposition, macroName, log ) \
|
#define INTERNAL_CATCH_MSG( messageType, resultDisposition, macroName, log ) \
|
||||||
do { \
|
do { \
|
||||||
Catch::ResultBuilder __catchResult( macroName, CATCH_INTERNAL_LINEINFO, "", resultDisposition ); \
|
Catch::ResultBuilder __catchResult( C_A_T_C_H_Context(), macroName, CATCH_INTERNAL_LINEINFO, "", resultDisposition ); \
|
||||||
__catchResult << log + ::Catch::StreamEndStop(); \
|
__catchResult << log + ::Catch::StreamEndStop(); \
|
||||||
__catchResult.captureResult( messageType ); \
|
__catchResult.captureResult( messageType ); \
|
||||||
INTERNAL_CATCH_REACT( __catchResult ) \
|
INTERNAL_CATCH_REACT( __catchResult ) \
|
||||||
@ -125,12 +122,12 @@ namespace Catch {
|
|||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
#define INTERNAL_CATCH_INFO( log, macroName ) \
|
#define INTERNAL_CATCH_INFO( log, macroName ) \
|
||||||
Catch::ScopedMessage INTERNAL_CATCH_UNIQUE_NAME( scopedMessage ) = Catch::MessageBuilder( macroName, CATCH_INTERNAL_LINEINFO, Catch::ResultWas::Info ) << log;
|
Catch::ScopedMessage INTERNAL_CATCH_UNIQUE_NAME( scopedMessage ) = Catch::MessageBuilder( C_A_T_C_H_Context(), macroName, CATCH_INTERNAL_LINEINFO, Catch::ResultWas::Info ) << log;
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
#define INTERNAL_CHECK_THAT( arg, matcher, resultDisposition, macroName ) \
|
#define INTERNAL_CHECK_THAT( arg, matcher, resultDisposition, macroName ) \
|
||||||
do { \
|
do { \
|
||||||
Catch::ResultBuilder __catchResult( macroName, CATCH_INTERNAL_LINEINFO, #arg ", " #matcher, resultDisposition ); \
|
Catch::ResultBuilder __catchResult( C_A_T_C_H_Context(), macroName, CATCH_INTERNAL_LINEINFO, #arg ", " #matcher, resultDisposition ); \
|
||||||
try { \
|
try { \
|
||||||
std::string matcherAsString = (matcher).toString(); \
|
std::string matcherAsString = (matcher).toString(); \
|
||||||
__catchResult \
|
__catchResult \
|
||||||
|
@ -150,7 +150,7 @@ namespace Catch {
|
|||||||
}
|
}
|
||||||
ConfigData m_data;
|
ConfigData m_data;
|
||||||
|
|
||||||
std::auto_ptr<IStream const> m_stream;
|
CATCH_AUTO_PTR( IStream const ) m_stream;
|
||||||
TestSpec m_testSpec;
|
TestSpec m_testSpec;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -16,7 +16,6 @@ namespace Catch {
|
|||||||
|
|
||||||
class TestCase;
|
class TestCase;
|
||||||
class AssertionResult;
|
class AssertionResult;
|
||||||
class ScopedMessageBuilder;
|
|
||||||
|
|
||||||
struct AssertionInfo;
|
struct AssertionInfo;
|
||||||
struct SectionInfo;
|
struct SectionInfo;
|
||||||
@ -48,10 +47,21 @@ namespace Catch {
|
|||||||
virtual IConfig const& config() const = 0;
|
virtual IConfig const& config() const = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
IRunContext* tryGetCurrentRunContext();
|
|
||||||
IRunContext& getCurrentRunContext();
|
IRunContext& getCurrentRunContext();
|
||||||
|
|
||||||
IConfig const* getCurrentConfig();
|
IConfig const* getCurrentConfig();
|
||||||
|
|
||||||
|
class LocalContext {
|
||||||
|
|
||||||
|
public:
|
||||||
|
IRunContext& operator()() const {
|
||||||
|
return getCurrentRunContext(); // !TBD
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
inline Catch::IRunContext& C_A_T_C_H_Context() {
|
||||||
|
return Catch::getCurrentRunContext();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // TWOBLUECUBES_CATCH_INTERFACES_CAPTURE_H_INCLUDED
|
#endif // TWOBLUECUBES_CATCH_INTERFACES_CAPTURE_H_INCLUDED
|
||||||
|
@ -91,12 +91,9 @@ namespace Catch
|
|||||||
{
|
{
|
||||||
if( assertionResult.hasMessage() ) {
|
if( assertionResult.hasMessage() ) {
|
||||||
// Copy message into messages list.
|
// Copy message into messages list.
|
||||||
// !TBD This should have been done earlier, somewhere
|
MessageInfo info( assertionResult.getTestMacroName(), assertionResult.getSourceInfo(), assertionResult.getResultType() );
|
||||||
MessageBuilder builder( assertionResult.getTestMacroName(), assertionResult.getSourceInfo(), assertionResult.getResultType() );
|
info.message = assertionResult.getMessage();
|
||||||
builder << assertionResult.getMessage();
|
infoMessages.push_back( info );
|
||||||
builder.m_info.message = builder.m_stream.str();
|
|
||||||
|
|
||||||
infoMessages.push_back( builder.m_info );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual ~AssertionStats();
|
virtual ~AssertionStats();
|
||||||
|
@ -46,7 +46,7 @@ namespace Catch
|
|||||||
it != itEnd;
|
it != itEnd;
|
||||||
++it ) {
|
++it ) {
|
||||||
if( it->type == ResultWas::Info ) {
|
if( it->type == ResultWas::Info ) {
|
||||||
ResultBuilder rb( it->macroName.c_str(), it->lineInfo, "", ResultDisposition::Normal );
|
ResultBuilder rb( getCurrentRunContext(), it->macroName.c_str(), it->lineInfo, "", ResultDisposition::Normal );
|
||||||
rb << it->message;
|
rb << it->message;
|
||||||
rb.setResultType( ResultWas::Info );
|
rb.setResultType( ResultWas::Info );
|
||||||
AssertionResult result = rb.build();
|
AssertionResult result = rb.build();
|
||||||
|
@ -38,10 +38,12 @@ namespace Catch {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct MessageBuilder {
|
struct MessageBuilder {
|
||||||
MessageBuilder( std::string const& macroName,
|
MessageBuilder( IRunContext& runContext,
|
||||||
|
std::string const& macroName,
|
||||||
SourceLineInfo const& lineInfo,
|
SourceLineInfo const& lineInfo,
|
||||||
ResultWas::OfType type )
|
ResultWas::OfType type )
|
||||||
: m_info( macroName, lineInfo, type )
|
: m_runContext( runContext ),
|
||||||
|
m_info( macroName, lineInfo, type )
|
||||||
{}
|
{}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
@ -50,6 +52,7 @@ namespace Catch {
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
IRunContext& m_runContext;
|
||||||
MessageInfo m_info;
|
MessageInfo m_info;
|
||||||
std::ostringstream m_stream;
|
std::ostringstream m_stream;
|
||||||
};
|
};
|
||||||
|
@ -29,7 +29,7 @@ namespace Catch {
|
|||||||
|
|
||||||
ScopedMessage::ScopedMessage( MessageBuilder const& builder )
|
ScopedMessage::ScopedMessage( MessageBuilder const& builder )
|
||||||
: m_info( builder.m_info ),
|
: m_info( builder.m_info ),
|
||||||
m_runContext( getCurrentRunContext() )
|
m_runContext( builder.m_runContext )
|
||||||
{
|
{
|
||||||
m_info.message = builder.m_stream.str();
|
m_info.message = builder.m_stream.str();
|
||||||
m_runContext.pushScopedMessage( m_info );
|
m_runContext.pushScopedMessage( m_info );
|
||||||
|
@ -37,11 +37,13 @@ namespace Catch {
|
|||||||
|
|
||||||
class ResultBuilder {
|
class ResultBuilder {
|
||||||
public:
|
public:
|
||||||
ResultBuilder( char const* macroName,
|
ResultBuilder
|
||||||
SourceLineInfo const& lineInfo,
|
( IRunContext& runContext,
|
||||||
char const* capturedExpression,
|
char const* macroName,
|
||||||
ResultDisposition::Flags resultDisposition,
|
SourceLineInfo const& lineInfo,
|
||||||
char const* secondArg = "" );
|
char const* capturedExpression,
|
||||||
|
ResultDisposition::Flags resultDisposition,
|
||||||
|
char const* secondArg = "" );
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
ExpressionLhs<T const&> operator <= ( T const& operand );
|
ExpressionLhs<T const&> operator <= ( T const& operand );
|
||||||
|
@ -21,12 +21,14 @@ namespace Catch {
|
|||||||
? capturedExpression
|
? capturedExpression
|
||||||
: capturedExpression + ", " + secondArg;
|
: capturedExpression + ", " + secondArg;
|
||||||
}
|
}
|
||||||
ResultBuilder::ResultBuilder( char const* macroName,
|
ResultBuilder::ResultBuilder
|
||||||
SourceLineInfo const& lineInfo,
|
( IRunContext& runContext,
|
||||||
char const* capturedExpression,
|
char const* macroName,
|
||||||
ResultDisposition::Flags resultDisposition,
|
SourceLineInfo const& lineInfo,
|
||||||
char const* secondArg )
|
char const* capturedExpression,
|
||||||
: m_runContext( getCurrentRunContext() ),
|
ResultDisposition::Flags resultDisposition,
|
||||||
|
char const* secondArg )
|
||||||
|
: m_runContext( runContext ),
|
||||||
m_assertionInfo( macroName, lineInfo, capturedExpressionWithSecondArgument( capturedExpression, secondArg ), resultDisposition ),
|
m_assertionInfo( macroName, lineInfo, capturedExpressionWithSecondArgument( capturedExpression, secondArg ), resultDisposition ),
|
||||||
m_shouldDebugBreak( false ),
|
m_shouldDebugBreak( false ),
|
||||||
m_shouldThrow( false )
|
m_shouldThrow( false )
|
||||||
|
@ -75,9 +75,6 @@ namespace Catch {
|
|||||||
else
|
else
|
||||||
return CATCH_NULL;
|
return CATCH_NULL;
|
||||||
}
|
}
|
||||||
AssertionResult const* getLastResult() {
|
|
||||||
return getCurrentRunContext().getLastResult();
|
|
||||||
}
|
|
||||||
|
|
||||||
class RunContext : public IRunContext {
|
class RunContext : public IRunContext {
|
||||||
|
|
||||||
@ -243,7 +240,8 @@ namespace Catch {
|
|||||||
|
|
||||||
// Recreate section for test case (as we will lose the one that was in scope)
|
// Recreate section for test case (as we will lose the one that was in scope)
|
||||||
SectionInfo testCaseSection
|
SectionInfo testCaseSection
|
||||||
( m_activeTestCaseInfo->lineInfo,
|
( C_A_T_C_H_Context(),
|
||||||
|
m_activeTestCaseInfo->lineInfo,
|
||||||
m_activeTestCaseInfo->name,
|
m_activeTestCaseInfo->name,
|
||||||
m_activeTestCaseInfo->description );
|
m_activeTestCaseInfo->description );
|
||||||
|
|
||||||
@ -273,7 +271,7 @@ namespace Catch {
|
|||||||
private:
|
private:
|
||||||
|
|
||||||
void runTest( TestCase const& testCase, std::string& redirectedCout, std::string& redirectedCerr ) {
|
void runTest( TestCase const& testCase, std::string& redirectedCout, std::string& redirectedCerr ) {
|
||||||
SectionInfo testCaseSection( testCase.lineInfo, testCase.name, testCase.description );
|
SectionInfo testCaseSection( *this, testCase.lineInfo, testCase.name, testCase.description );
|
||||||
m_reporter->sectionStarting( testCaseSection );
|
m_reporter->sectionStarting( testCaseSection );
|
||||||
Counts prevAssertions = m_totals.assertions;
|
Counts prevAssertions = m_totals.assertions;
|
||||||
double duration = 0;
|
double duration = 0;
|
||||||
@ -325,11 +323,13 @@ namespace Catch {
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
ResultBuilder makeUnexpectedResultBuilder() const {
|
ResultBuilder makeUnexpectedResultBuilder() {
|
||||||
return ResultBuilder( m_lastAssertionInfo.macroName.c_str(),
|
return ResultBuilder
|
||||||
m_lastAssertionInfo.lineInfo,
|
( *this,
|
||||||
m_lastAssertionInfo.capturedExpression.c_str(),
|
m_lastAssertionInfo.macroName.c_str(),
|
||||||
m_lastAssertionInfo.resultDisposition );
|
m_lastAssertionInfo.lineInfo,
|
||||||
|
m_lastAssertionInfo.capturedExpression.c_str(),
|
||||||
|
m_lastAssertionInfo.resultDisposition );
|
||||||
}
|
}
|
||||||
|
|
||||||
void handleUnfinishedSections() {
|
void handleUnfinishedSections() {
|
||||||
|
@ -40,10 +40,10 @@ namespace Catch {
|
|||||||
|
|
||||||
#ifdef CATCH_CONFIG_VARIADIC_MACROS
|
#ifdef CATCH_CONFIG_VARIADIC_MACROS
|
||||||
#define INTERNAL_CATCH_SECTION( ... ) \
|
#define INTERNAL_CATCH_SECTION( ... ) \
|
||||||
if( Catch::Section const& INTERNAL_CATCH_UNIQUE_NAME( catch_internal_Section ) = Catch::SectionInfo( CATCH_INTERNAL_LINEINFO, __VA_ARGS__ ) )
|
if( Catch::Section const& INTERNAL_CATCH_UNIQUE_NAME( catch_internal_Section ) = Catch::SectionInfo( C_A_T_C_H_Context(), CATCH_INTERNAL_LINEINFO, __VA_ARGS__ ) )
|
||||||
#else
|
#else
|
||||||
#define INTERNAL_CATCH_SECTION( name, desc ) \
|
#define INTERNAL_CATCH_SECTION( name, desc ) \
|
||||||
if( Catch::Section const& INTERNAL_CATCH_UNIQUE_NAME( catch_internal_Section ) = Catch::SectionInfo( CATCH_INTERNAL_LINEINFO, name, desc ) )
|
if( Catch::Section const& INTERNAL_CATCH_UNIQUE_NAME( catch_internal_Section ) = Catch::SectionInfo( C_A_T_C_H_Context(), CATCH_INTERNAL_LINEINFO, name, desc ) )
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif // TWOBLUECUBES_CATCH_SECTION_H_INCLUDED
|
#endif // TWOBLUECUBES_CATCH_SECTION_H_INCLUDED
|
||||||
|
@ -16,17 +16,19 @@
|
|||||||
namespace Catch {
|
namespace Catch {
|
||||||
|
|
||||||
SectionInfo::SectionInfo
|
SectionInfo::SectionInfo
|
||||||
( SourceLineInfo const& _lineInfo,
|
( IRunContext& _runContext,
|
||||||
|
SourceLineInfo const& _lineInfo,
|
||||||
std::string const& _name,
|
std::string const& _name,
|
||||||
std::string const& _description )
|
std::string const& _description )
|
||||||
: name( _name ),
|
: runContext( &_runContext ),
|
||||||
|
name( _name ),
|
||||||
description( _description ),
|
description( _description ),
|
||||||
lineInfo( _lineInfo )
|
lineInfo( _lineInfo )
|
||||||
{}
|
{}
|
||||||
|
|
||||||
Section::Section( SectionInfo const& info )
|
Section::Section( SectionInfo const& info )
|
||||||
: m_info( info ),
|
: m_info( info ),
|
||||||
m_runContext( getCurrentRunContext() ),
|
m_runContext( *info.runContext ),
|
||||||
m_sectionIncluded( m_runContext.sectionStarted( m_info, m_assertions ) )
|
m_sectionIncluded( m_runContext.sectionStarted( m_info, m_assertions ) )
|
||||||
{
|
{
|
||||||
m_timer.start();
|
m_timer.start();
|
||||||
|
@ -10,15 +10,18 @@
|
|||||||
|
|
||||||
#include "catch_common.h"
|
#include "catch_common.h"
|
||||||
#include "catch_totals.hpp"
|
#include "catch_totals.hpp"
|
||||||
|
#include "catch_interfaces_capture.h"
|
||||||
|
|
||||||
namespace Catch {
|
namespace Catch {
|
||||||
|
|
||||||
struct SectionInfo {
|
struct SectionInfo {
|
||||||
SectionInfo
|
SectionInfo
|
||||||
( SourceLineInfo const& _lineInfo,
|
( IRunContext& _runContext,
|
||||||
|
SourceLineInfo const& _lineInfo,
|
||||||
std::string const& _name,
|
std::string const& _name,
|
||||||
std::string const& _description = std::string() );
|
std::string const& _description = std::string() );
|
||||||
|
|
||||||
|
IRunContext* runContext;
|
||||||
std::string name;
|
std::string name;
|
||||||
std::string description;
|
std::string description;
|
||||||
SourceLineInfo lineInfo;
|
SourceLineInfo lineInfo;
|
||||||
|
@ -9,33 +9,10 @@
|
|||||||
#include "internal/catch_test_case_tracker.hpp"
|
#include "internal/catch_test_case_tracker.hpp"
|
||||||
|
|
||||||
|
|
||||||
namespace Catch
|
|
||||||
{
|
|
||||||
class LocalContext {
|
|
||||||
|
|
||||||
public:
|
|
||||||
TrackerContext& operator()() const {
|
|
||||||
return TrackerContext::instance();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace Catch
|
|
||||||
|
|
||||||
inline Catch::TrackerContext& C_A_T_C_H_Context() {
|
|
||||||
return Catch::TrackerContext::instance();
|
|
||||||
}
|
|
||||||
|
|
||||||
// -------------------
|
|
||||||
|
|
||||||
#include "catch.hpp"
|
#include "catch.hpp"
|
||||||
|
|
||||||
using namespace Catch;
|
using namespace Catch;
|
||||||
|
|
||||||
//inline void testCase( Catch::LocalContext const& C_A_T_C_H_Context ) {
|
|
||||||
//
|
|
||||||
// REQUIRE( C_A_T_C_H_Context().i() == 42 );
|
|
||||||
//}
|
|
||||||
|
|
||||||
TEST_CASE( "Tracker", "" ) {
|
TEST_CASE( "Tracker", "" ) {
|
||||||
|
|
||||||
TrackerContext ctx;
|
TrackerContext ctx;
|
||||||
|
Loading…
Reference in New Issue
Block a user