diff options
| author | Phil Nash | 2012-05-21 18:52:09 +0100 |
|---|---|---|
| committer | Phil Nash | 2012-05-21 18:52:09 +0100 |
| commit | 371db8b42fb2171ea2ab542a9875ddf4e3e8b8ea (patch) | |
| tree | 43a7fd79a8295ed35621e596f14c782b3fcfa9ec /include/internal | |
| parent | 89d2a3f911cd87a6bef96aceb1702e65eee73163 (diff) | |
| download | catch3-371db8b42fb2171ea2ab542a9875ddf4e3e8b8ea.tar.gz | |
Context methods are non-static - accessed via interface
This is a move towards allowing multiple contexts - with the concept of a (possibly thread local) "current" context
Diffstat (limited to 'include/internal')
| -rw-r--r-- | include/internal/catch_capture.hpp | 20 | ||||
| -rw-r--r-- | include/internal/catch_config.hpp | 4 | ||||
| -rw-r--r-- | include/internal/catch_context.h | 58 | ||||
| -rw-r--r-- | include/internal/catch_context_impl.hpp | 36 | ||||
| -rw-r--r-- | include/internal/catch_evaluate.hpp | 27 | ||||
| -rw-r--r-- | include/internal/catch_generators.hpp | 2 | ||||
| -rw-r--r-- | include/internal/catch_interfaces_exception.h | 2 | ||||
| -rw-r--r-- | include/internal/catch_list.hpp | 9 | ||||
| -rw-r--r-- | include/internal/catch_objc.hpp | 2 | ||||
| -rw-r--r-- | include/internal/catch_reporter_registrars.hpp | 2 | ||||
| -rw-r--r-- | include/internal/catch_runner_impl.hpp | 27 | ||||
| -rw-r--r-- | include/internal/catch_section.hpp | 4 | ||||
| -rw-r--r-- | include/internal/catch_test_case_registry_impl.hpp | 2 |
13 files changed, 108 insertions, 87 deletions
diff --git a/include/internal/catch_capture.hpp b/include/internal/catch_capture.hpp index 688f8455..0724b089 100644 --- a/include/internal/catch_capture.hpp +++ b/include/internal/catch_capture.hpp @@ -22,11 +22,11 @@ struct TestFailureException{}; class ScopedInfo { public: ScopedInfo() : m_oss() { - Context::getResultCapture().pushScopedInfo( this ); + getCurrentContext().getResultCapture().pushScopedInfo( this ); } ~ScopedInfo() { - Context::getResultCapture().popScopedInfo( this ); + getCurrentContext().getResultCapture().popScopedInfo( this ); } template<typename T> @@ -50,7 +50,7 @@ inline bool isTrue( bool value ){ return value; } /////////////////////////////////////////////////////////////////////////////// #define INTERNAL_CATCH_ACCEPT_EXPR( expr, stopOnFailure, originalExpr ) \ - if( Catch::ResultAction::Value internal_catch_action = Catch::Context::getResultCapture().acceptExpression( expr ) ) \ + if( Catch::ResultAction::Value internal_catch_action = Catch::getCurrentContext().getResultCapture().acceptExpression( expr ) ) \ { \ if( internal_catch_action == Catch::ResultAction::DebugFailed ) BreakIntoDebugger(); \ if( Catch::isTrue( stopOnFailure ) ) throw Catch::TestFailureException(); \ @@ -64,19 +64,19 @@ inline bool isTrue( bool value ){ return value; } }catch( Catch::TestFailureException& ){ \ throw; \ } catch( ... ){ \ - INTERNAL_CATCH_ACCEPT_EXPR( ( Catch::ExpressionBuilder( CATCH_INTERNAL_LINEINFO, macroName, #expr ) << Catch::Context::getExceptionTranslatorRegistry().translateActiveException() ).setResultType( Catch::ResultWas::ThrewException ), false, expr ); \ + INTERNAL_CATCH_ACCEPT_EXPR( ( Catch::ExpressionBuilder( CATCH_INTERNAL_LINEINFO, macroName, #expr ) << Catch::getCurrentContext().getExceptionTranslatorRegistry().translateActiveException() ).setResultType( Catch::ResultWas::ThrewException ), false, expr ); \ throw; \ }}while( Catch::isTrue( false ) ) /////////////////////////////////////////////////////////////////////////////// #define INTERNAL_CATCH_IF( expr, isNot, stopOnFailure, macroName ) \ INTERNAL_CATCH_TEST( expr, isNot, stopOnFailure, macroName ); \ - if( Catch::Context::getResultCapture().getLastResult()->ok() ) + if( Catch::getCurrentContext().getResultCapture().getLastResult()->ok() ) /////////////////////////////////////////////////////////////////////////////// #define INTERNAL_CATCH_ELSE( expr, isNot, stopOnFailure, macroName ) \ INTERNAL_CATCH_TEST( expr, isNot, stopOnFailure, macroName ); \ - if( !Catch::Context::getResultCapture().getLastResult()->ok() ) + if( !Catch::getCurrentContext().getResultCapture().getLastResult()->ok() ) /////////////////////////////////////////////////////////////////////////////// #define INTERNAL_CATCH_NO_THROW( expr, stopOnFailure, macroName ) \ @@ -87,7 +87,7 @@ inline bool isTrue( bool value ){ return value; } } \ catch( ... ) \ { \ - INTERNAL_CATCH_ACCEPT_EXPR( ( Catch::ExpressionBuilder( CATCH_INTERNAL_LINEINFO, macroName, #expr ) << Catch::Context::getExceptionTranslatorRegistry().translateActiveException() ).setResultType( Catch::ResultWas::ThrewException ), stopOnFailure, false ); \ + INTERNAL_CATCH_ACCEPT_EXPR( ( Catch::ExpressionBuilder( CATCH_INTERNAL_LINEINFO, macroName, #expr ) << Catch::getCurrentContext().getExceptionTranslatorRegistry().translateActiveException() ).setResultType( Catch::ResultWas::ThrewException ), stopOnFailure, false ); \ } /////////////////////////////////////////////////////////////////////////////// @@ -111,12 +111,12 @@ inline bool isTrue( bool value ){ return value; } INTERNAL_CATCH_THROWS( expr, exceptionType, stopOnFailure, macroName ) \ catch( ... ) \ { \ - INTERNAL_CATCH_ACCEPT_EXPR( ( Catch::ExpressionBuilder( CATCH_INTERNAL_LINEINFO, macroName, #expr ) << Catch::Context::getExceptionTranslatorRegistry().translateActiveException() ).setResultType( Catch::ResultWas::ThrewException ), stopOnFailure, false ); \ + INTERNAL_CATCH_ACCEPT_EXPR( ( Catch::ExpressionBuilder( CATCH_INTERNAL_LINEINFO, macroName, #expr ) << Catch::getCurrentContext().getExceptionTranslatorRegistry().translateActiveException() ).setResultType( Catch::ResultWas::ThrewException ), stopOnFailure, false ); \ } /////////////////////////////////////////////////////////////////////////////// #define INTERNAL_CATCH_MSG( reason, resultType, stopOnFailure, macroName ) \ - Catch::Context::getResultCapture().acceptExpression( ( Catch::ExpressionBuilder( CATCH_INTERNAL_LINEINFO, macroName ) << reason ).setResultType( resultType ) ); + Catch::getCurrentContext().getResultCapture().acceptExpression( ( Catch::ExpressionBuilder( CATCH_INTERNAL_LINEINFO, macroName ) << reason ).setResultType( resultType ) ); /////////////////////////////////////////////////////////////////////////////// #define INTERNAL_CATCH_SCOPED_INFO( log ) \ @@ -130,7 +130,7 @@ inline bool isTrue( bool value ){ return value; } }catch( Catch::TestFailureException& ){ \ throw; \ } catch( ... ){ \ - INTERNAL_CATCH_ACCEPT_EXPR( ( Catch::ExpressionBuilder( CATCH_INTERNAL_LINEINFO, macroName, #arg " " #matcher ) << Catch::Context::getExceptionTranslatorRegistry().translateActiveException() ).setResultType( Catch::ResultWas::ThrewException ), false, false ); \ + INTERNAL_CATCH_ACCEPT_EXPR( ( Catch::ExpressionBuilder( CATCH_INTERNAL_LINEINFO, macroName, #arg " " #matcher ) << Catch::getCurrentContext().getExceptionTranslatorRegistry().translateActiveException() ).setResultType( Catch::ResultWas::ThrewException ), false, false ); \ throw; \ }}while( Catch::isTrue( false ) ) diff --git a/include/internal/catch_config.hpp b/include/internal/catch_config.hpp index 6f26a64d..d6bd0819 100644 --- a/include/internal/catch_config.hpp +++ b/include/internal/catch_config.hpp @@ -62,7 +62,7 @@ namespace Catch { void setReporter( const std::string& reporterName ) { if( m_reporter.get() ) return setError( "Only one reporter may be specified" ); - setReporter( Context::getReporterRegistry().create( reporterName, *this ) ); + setReporter( getCurrentContext().getReporterRegistry().create( reporterName, *this ) ); } void addTestSpec( const std::string& testSpec ) { @@ -107,7 +107,7 @@ namespace Catch { Ptr<IReporter> getReporter() { if( !m_reporter.get() ) - const_cast<Config*>( this )->setReporter( Context::getReporterRegistry().create( "basic", *this ) ); + const_cast<Config*>( this )->setReporter( getCurrentContext().getReporterRegistry().create( "basic", *this ) ); return m_reporter; } diff --git a/include/internal/catch_context.h b/include/internal/catch_context.h index 1e3711e7..6d0052f9 100644 --- a/include/internal/catch_context.h +++ b/include/internal/catch_context.h @@ -25,28 +25,56 @@ namespace Catch { class StreamBufBase : public std::streambuf{}; - class Context { + struct IContext + { + virtual IResultCapture& getResultCapture() = 0; + virtual IRunner& getRunner() = 0; + virtual IReporterRegistry& getReporterRegistry() = 0; + virtual ITestCaseRegistry& getTestCaseRegistry() = 0; + virtual IExceptionTranslatorRegistry& getExceptionTranslatorRegistry() = 0; + virtual size_t getGeneratorIndex( const std::string& fileInfo, size_t totalSize ) = 0; + virtual bool advanceGeneratorsForCurrentTest() = 0; + }; + + struct IMutableContext : IContext + { + virtual void setResultCapture( IResultCapture* resultCapture ) = 0; + virtual void setRunner( IRunner* runner ) = 0; + }; + + IContext& getCurrentContext(); + IMutableContext& getCurrentMutableContext(); + + class Context : public IMutableContext { - Context(); + Context(); Context( const Context& ); void operator=( const Context& ); - static Context& me(); - - public: - static void setRunner( IRunner* runner ); - static void setResultCapture( IResultCapture* resultCapture ); - static IResultCapture& getResultCapture(); - static IReporterRegistry& getReporterRegistry(); - static ITestCaseRegistry& getTestCaseRegistry(); - static IExceptionTranslatorRegistry& getExceptionTranslatorRegistry(); + + public: // friends + friend IContext& getCurrentContext() { return Context::getCurrent(); } + friend IMutableContext& getCurrentMutableContext() { return Context::getCurrent(); } + + public: // IContext + virtual IResultCapture& getResultCapture(); + virtual IRunner& getRunner(); + virtual IReporterRegistry& getReporterRegistry(); + virtual ITestCaseRegistry& getTestCaseRegistry(); + virtual IExceptionTranslatorRegistry& getExceptionTranslatorRegistry(); + virtual size_t getGeneratorIndex( const std::string& fileInfo, size_t totalSize ); + virtual bool advanceGeneratorsForCurrentTest(); + + public: // IMutableContext + virtual void setResultCapture( IResultCapture* resultCapture ); + virtual void setRunner( IRunner* runner ); + + public: // Statics static std::streambuf* createStreamBuf( const std::string& streamName ); - static IRunner& getRunner(); - static size_t getGeneratorIndex( const std::string& fileInfo, size_t totalSize ); - static bool advanceGeneratorsForCurrentTest(); static void cleanUp(); private: - static Context*& singleInstance(); + static Context& getCurrent(); + static Context*& singleInstance(); GeneratorsForTest* findGeneratorsForCurrentTest(); GeneratorsForTest& getGeneratorsForCurrentTest(); diff --git a/include/internal/catch_context_impl.hpp b/include/internal/catch_context_impl.hpp index b807f4db..83b52869 100644 --- a/include/internal/catch_context_impl.hpp +++ b/include/internal/catch_context_impl.hpp @@ -17,13 +17,20 @@ namespace Catch { + + Context::Context() : m_reporterRegistry( new ReporterRegistry ), m_testCaseRegistry( new TestRegistry ), m_exceptionTranslatorRegistry( new ExceptionTranslatorRegistry ) {} - Context& Context::me() { + Context*& Context::singleInstance() { + static Context* hub = NULL; + return hub; + } + + Context& Context::getCurrent() { Context*& hub = singleInstance(); if( !hub ) hub = new Context(); @@ -36,37 +43,32 @@ namespace Catch { hub = NULL; } - Context*& Context::singleInstance() { - static Context* hub = NULL; - return hub; - } - void Context::setRunner( IRunner* runner ) { - me().m_runner = runner; + m_runner = runner; } void Context::setResultCapture( IResultCapture* resultCapture ) { - me().m_resultCapture = resultCapture; + m_resultCapture = resultCapture; } IResultCapture& Context::getResultCapture() { - return *me().m_resultCapture; + return *m_resultCapture; } IRunner& Context::getRunner() { - return *me().m_runner; + return *m_runner; } IReporterRegistry& Context::getReporterRegistry() { - return *me().m_reporterRegistry.get(); + return *m_reporterRegistry.get(); } ITestCaseRegistry& Context::getTestCaseRegistry() { - return *me().m_testCaseRegistry.get(); + return *m_testCaseRegistry.get(); } IExceptionTranslatorRegistry& Context::getExceptionTranslatorRegistry() { - return *me().m_exceptionTranslatorRegistry.get(); + return *m_exceptionTranslatorRegistry.get(); } std::streambuf* Context::createStreamBuf( const std::string& streamName ) { @@ -78,7 +80,7 @@ namespace Catch { } GeneratorsForTest* Context::findGeneratorsForCurrentTest() { - std::string testName = getResultCapture().getCurrentTestName(); + std::string testName = getCurrentContext().getResultCapture().getCurrentTestName(); std::map<std::string, GeneratorsForTest*>::const_iterator it = m_generatorsByTestName.find( testName ); @@ -90,7 +92,7 @@ namespace Catch { GeneratorsForTest& Context::getGeneratorsForCurrentTest() { GeneratorsForTest* generators = findGeneratorsForCurrentTest(); if( !generators ) { - std::string testName = getResultCapture().getCurrentTestName(); + std::string testName = getCurrentContext().getResultCapture().getCurrentTestName(); generators = new GeneratorsForTest(); m_generatorsByTestName.insert( std::make_pair( testName, generators ) ); } @@ -98,13 +100,13 @@ namespace Catch { } size_t Context::getGeneratorIndex( const std::string& fileInfo, size_t totalSize ) { - return me().getGeneratorsForCurrentTest() + return getGeneratorsForCurrentTest() .getGeneratorInfo( fileInfo, totalSize ) .getCurrentIndex(); } bool Context::advanceGeneratorsForCurrentTest() { - GeneratorsForTest* generators = me().findGeneratorsForCurrentTest(); + GeneratorsForTest* generators = findGeneratorsForCurrentTest(); return generators && generators->moveNext(); } } diff --git a/include/internal/catch_evaluate.hpp b/include/internal/catch_evaluate.hpp index 78472f6b..686e0b30 100644 --- a/include/internal/catch_evaluate.hpp +++ b/include/internal/catch_evaluate.hpp @@ -20,26 +20,13 @@ namespace Internal { IsGreaterThanOrEqualTo }; - template<Operator Op> - struct OperatorTraits{ static const char* getName(){ return "*error - unknown operator*"; } }; - - template<> - struct OperatorTraits<IsEqualTo>{ static const char* getName(){ return "=="; } }; - - template<> - struct OperatorTraits<IsNotEqualTo>{ static const char* getName(){ return "!="; } }; - - template<> - struct OperatorTraits<IsLessThan>{ static const char* getName(){ return "<"; } }; - - template<> - struct OperatorTraits<IsGreaterThan>{ static const char* getName(){ return ">"; } }; - - template<> - struct OperatorTraits<IsLessThanOrEqualTo>{ static const char* getName(){ return "<="; } }; - - template<> - struct OperatorTraits<IsGreaterThanOrEqualTo>{ static const char* getName(){ return ">="; } }; + template<Operator Op> struct OperatorTraits { static const char* getName(){ return "*error*"; } }; + template<> struct OperatorTraits<IsEqualTo> { static const char* getName(){ return "=="; } }; + template<> struct OperatorTraits<IsNotEqualTo> { static const char* getName(){ return "!="; } }; + template<> struct OperatorTraits<IsLessThan> { static const char* getName(){ return "<"; } }; + template<> struct OperatorTraits<IsGreaterThan> { static const char* getName(){ return ">"; } }; + template<> struct OperatorTraits<IsLessThanOrEqualTo> { static const char* getName(){ return "<="; } }; + template<> struct OperatorTraits<IsGreaterThanOrEqualTo>{ static const char* getName(){ return ">="; } }; // So the compare overloads can be operator agnostic we convey the operator as a template // enum, which is used to specialise an Evaluator for doing the comparison. diff --git a/include/internal/catch_generators.hpp b/include/internal/catch_generators.hpp index 6c72c397..295db35d 100644 --- a/include/internal/catch_generators.hpp +++ b/include/internal/catch_generators.hpp @@ -87,7 +87,7 @@ public: } operator T () const { - size_t overallIndex = Context::getGeneratorIndex( m_fileInfo, m_totalSize ); + size_t overallIndex = getCurrentContext().getGeneratorIndex( m_fileInfo, m_totalSize ); typename std::vector<const IGenerator<T>*>::const_iterator it = m_composed.begin(); typename std::vector<const IGenerator<T>*>::const_iterator itEnd = m_composed.end(); diff --git a/include/internal/catch_interfaces_exception.h b/include/internal/catch_interfaces_exception.h index 9c699583..3bb23ebd 100644 --- a/include/internal/catch_interfaces_exception.h +++ b/include/internal/catch_interfaces_exception.h @@ -51,7 +51,7 @@ namespace Catch { public: template<typename T> ExceptionTranslatorRegistrar( std::string(*translateFunction)( T& ) ) { - Catch::Context::getExceptionTranslatorRegistry().registerTranslator + getCurrentContext().getExceptionTranslatorRegistry().registerTranslator ( new ExceptionTranslator<T>( translateFunction ) ); } }; diff --git a/include/internal/catch_list.hpp b/include/internal/catch_list.hpp index 773547f5..266a12b3 100644 --- a/include/internal/catch_list.hpp +++ b/include/internal/catch_list.hpp @@ -14,10 +14,11 @@ namespace Catch { inline int List( Config& config ) { + IContext& context = getCurrentContext(); if( config.listWhat() & Config::List::Reports ) { std::cout << "Available reports:\n"; - IReporterRegistry::FactoryMap::const_iterator it = Context::getReporterRegistry().getFactories().begin(); - IReporterRegistry::FactoryMap::const_iterator itEnd = Context::getReporterRegistry().getFactories().end(); + IReporterRegistry::FactoryMap::const_iterator it = context.getReporterRegistry().getFactories().begin(); + IReporterRegistry::FactoryMap::const_iterator itEnd = context.getReporterRegistry().getFactories().end(); for(; it != itEnd; ++it ) { // !TBD: consider listAs() std::cout << "\t" << it->first << "\n\t\t'" << it->second->getDescription() << "'\n"; @@ -27,8 +28,8 @@ namespace Catch { if( config.listWhat() & Config::List::Tests ) { std::cout << "Available tests:\n"; - std::vector<TestCaseInfo>::const_iterator it = Context::getTestCaseRegistry().getAllTests().begin(); - std::vector<TestCaseInfo>::const_iterator itEnd = Context::getTestCaseRegistry().getAllTests().end(); + std::vector<TestCaseInfo>::const_iterator it = context.getTestCaseRegistry().getAllTests().begin(); + std::vector<TestCaseInfo>::const_iterator itEnd = context.getTestCaseRegistry().getAllTests().end(); for(; it != itEnd; ++it ) { // !TBD: consider listAs() std::cout << "\t" << it->getName() << "\n\t\t '" << it->getDescription() << "'\n"; diff --git a/include/internal/catch_objc.hpp b/include/internal/catch_objc.hpp index 6db1b707..91fc8df8 100644 --- a/include/internal/catch_objc.hpp +++ b/include/internal/catch_objc.hpp @@ -137,7 +137,7 @@ namespace Catch { std::string name = Detail::getAnnotation( cls, "Name", testCaseName ); std::string desc = Detail::getAnnotation( cls, "Description", testCaseName ); - Context::getTestCaseRegistry().registerTest( TestCaseInfo( new OcMethod( cls, selector ), name.c_str(), desc.c_str(), SourceLineInfo() ) ); + getCurrentContext().getTestCaseRegistry().registerTest( TestCaseInfo( new OcMethod( cls, selector ), name.c_str(), desc.c_str(), SourceLineInfo() ) ); noTestMethods++; } } diff --git a/include/internal/catch_reporter_registrars.hpp b/include/internal/catch_reporter_registrars.hpp index 05e7c713..e650cd0c 100644 --- a/include/internal/catch_reporter_registrars.hpp +++ b/include/internal/catch_reporter_registrars.hpp @@ -29,7 +29,7 @@ namespace Catch { public: ReporterRegistrar( const std::string& name ) { - Context::getReporterRegistry().registerReporter( name, new ReporterFactory() ); + getCurrentContext().getReporterRegistry().registerReporter( name, new ReporterFactory() ); } }; } diff --git a/include/internal/catch_runner_impl.hpp b/include/internal/catch_runner_impl.hpp index 3ca2fe36..fd30d8f5 100644 --- a/include/internal/catch_runner_impl.hpp +++ b/include/internal/catch_runner_impl.hpp @@ -56,25 +56,26 @@ namespace Catch { public: explicit Runner( Config& config ) - : m_runningTest( NULL ), + : m_context( getCurrentMutableContext() ), + m_runningTest( NULL ), m_config( config ), m_reporter( config.getReporter() ), - m_prevRunner( &Context::getRunner() ), - m_prevResultCapture( &Context::getResultCapture() ) + m_prevRunner( &m_context.getRunner() ), + m_prevResultCapture( &m_context.getResultCapture() ) { - Context::setRunner( this ); - Context::setResultCapture( this ); + m_context.setRunner( this ); + m_context.setResultCapture( this ); m_reporter->StartTesting(); } ~Runner() { m_reporter->EndTesting( m_totals ); - Context::setRunner( m_prevRunner ); - Context::setResultCapture( m_prevResultCapture ); + m_context.setRunner( m_prevRunner ); + m_context.setResultCapture( m_prevResultCapture ); } virtual void runAll( bool runHiddenTests = false ) { - std::vector<TestCaseInfo> allTests = Context::getTestCaseRegistry().getAllTests(); + const std::vector<TestCaseInfo>& allTests = getCurrentContext().getTestCaseRegistry().getAllTests(); for( std::size_t i=0; i < allTests.size(); ++i ) { if( runHiddenTests || !allTests[i].isHidden() ) runTest( allTests[i] ); @@ -84,7 +85,7 @@ namespace Catch { virtual std::size_t runMatching( const std::string& rawTestSpec ) { TestSpec testSpec( rawTestSpec ); - std::vector<TestCaseInfo> allTests = Context::getTestCaseRegistry().getAllTests(); + const std::vector<TestCaseInfo>& allTests = getCurrentContext().getTestCaseRegistry().getAllTests(); std::size_t testsRun = 0; for( std::size_t i=0; i < allTests.size(); ++i ) { if( testSpec.matches( allTests[i].getName() ) ) { @@ -114,7 +115,7 @@ namespace Catch { } while( m_runningTest->hasUntestedSections() ); } - while( Context::advanceGeneratorsForCurrentTest() ); + while( getCurrentContext().advanceGeneratorsForCurrentTest() ); delete m_runningTest; m_runningTest = NULL; @@ -251,13 +252,14 @@ namespace Catch { // This just means the test was aborted due to failure } catch(...) { - acceptMessage( Catch::Context::getExceptionTranslatorRegistry().translateActiveException() ); + acceptMessage( getCurrentContext().getExceptionTranslatorRegistry().translateActiveException() ); acceptResult( ResultWas::ThrewException ); } m_info.clear(); } private: + IMutableContext& m_context; RunningTest* m_runningTest; ResultInfoBuilder m_currentResult; ResultInfo m_lastResult; @@ -270,6 +272,7 @@ namespace Catch { IRunner* m_prevRunner; IResultCapture* m_prevResultCapture; }; -} + +} // end namespace Catch #endif // TWOBLUECUBES_INTERNAL_CATCH_RUNNER_HPP_INCLUDED diff --git a/include/internal/catch_section.hpp b/include/internal/catch_section.hpp index aee53b81..38bea0d2 100644 --- a/include/internal/catch_section.hpp +++ b/include/internal/catch_section.hpp @@ -21,12 +21,12 @@ namespace Catch { const std::string& description, const SourceLineInfo& lineInfo ) : m_name( name ), - m_sectionIncluded( Context::getResultCapture().sectionStarted( name, description, lineInfo, m_assertions ) ) + m_sectionIncluded( getCurrentContext().getResultCapture().sectionStarted( name, description, lineInfo, m_assertions ) ) {} ~Section() { if( m_sectionIncluded ) - Context::getResultCapture().sectionEnded( m_name, m_assertions ); + getCurrentContext().getResultCapture().sectionEnded( m_name, m_assertions ); } // This indicates whether the section should be executed or not diff --git a/include/internal/catch_test_case_registry_impl.hpp b/include/internal/catch_test_case_registry_impl.hpp index e5067875..cd0e0f16 100644 --- a/include/internal/catch_test_case_registry_impl.hpp +++ b/include/internal/catch_test_case_registry_impl.hpp @@ -109,7 +109,7 @@ namespace Catch { const char* name, const char* description, const SourceLineInfo& lineInfo ) { - Context::getTestCaseRegistry().registerTest( TestCaseInfo( testCase, name, description, lineInfo ) ); + getCurrentContext().getTestCaseRegistry().registerTest( TestCaseInfo( testCase, name, description, lineInfo ) ); } } // end namespace Catch |