Changed some names in test case registry

- in preparation for a bigger refactoring
This commit is contained in:
Phil Nash 2017-07-12 18:01:54 +01:00
parent 10c36aa74c
commit 79627cdcdb
7 changed files with 25 additions and 38 deletions

View file

@ -125,24 +125,16 @@ namespace Catch {
///////////////////////////////////////////////////////////////////////////
class FreeFunctionTestCase : public ITestCase {
class TestInvokerAsFunction : public ITestInvoker {
void(*m_testAsFunction)();
public:
TestInvokerAsFunction( void(*testAsFunction)() ) : m_testAsFunction( testAsFunction ) {}
FreeFunctionTestCase( TestFunction fun ) : m_fun( fun ) {}
virtual void invoke() const {
m_fun();
void invoke() const override {
m_testAsFunction();
}
private:
virtual ~FreeFunctionTestCase();
TestFunction m_fun;
};
FreeFunctionTestCase::~FreeFunctionTestCase() {}
inline std::string extractClassName( std::string const& classOrQualifiedMethodName ) {
std::string className = classOrQualifiedMethodName;
if( startsWith( className, '&' ) )
@ -157,7 +149,7 @@ namespace Catch {
}
void registerTestCase
( ITestCase* testCase,
( ITestInvoker* testCase,
char const* classOrQualifiedMethodName,
NameAndDesc const& nameAndDesc,
SourceLineInfo const& lineInfo ) {
@ -178,7 +170,7 @@ namespace Catch {
( TestFunction function,
SourceLineInfo const& lineInfo,
NameAndDesc const& nameAndDesc ) {
registerTestCase( new FreeFunctionTestCase( function ), "", nameAndDesc, lineInfo );
registerTestCase( new TestInvokerAsFunction( function ), "", nameAndDesc, lineInfo );
}
///////////////////////////////////////////////////////////////////////////