mirror of
https://github.com/catchorg/Catch2.git
synced 2025-05-28 07:29:25 +00:00
Changed some names in test case registry
- in preparation for a bigger refactoring
This commit is contained in:
parent
10c36aa74c
commit
79627cdcdb
7 changed files with 25 additions and 38 deletions
|
@ -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 );
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue