mirror of
https://github.com/catchorg/Catch2.git
synced 2024-11-26 15:26:11 +01:00
Make FixtureWrapper class name unique using the preprocessor instead of a specialisations
This commit is contained in:
parent
b3db552cfa
commit
06134ba167
@ -51,7 +51,11 @@ TEST_CASE_METHOD( Fixture, "./succeeding/Fixture/succeedingCase", "A method base
|
|||||||
REQUIRE( m_a == 1 );
|
REQUIRE( m_a == 1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE_METHOD( Fixture, "./failing/Fixture/failingCase", "A method based test run that fails" )
|
// We should be able to write our tests within a different namespace
|
||||||
|
namespace Inner
|
||||||
{
|
{
|
||||||
REQUIRE( m_a == 2 );
|
TEST_CASE_METHOD( Fixture, "./failing/Fixture/failingCase", "A method based test run that fails" )
|
||||||
|
{
|
||||||
|
REQUIRE( m_a == 2 );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -113,9 +113,6 @@ private:
|
|||||||
( const AutoReg& );
|
( const AutoReg& );
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename T, size_t>
|
|
||||||
struct FixtureWrapper{};
|
|
||||||
|
|
||||||
} // end namespace Catch
|
} // end namespace Catch
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
@ -136,11 +133,11 @@ struct FixtureWrapper{};
|
|||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
#define TEST_CASE_METHOD( ClassName, TestName, Desc )\
|
#define TEST_CASE_METHOD( ClassName, TestName, Desc )\
|
||||||
namespace Catch{ template<> struct FixtureWrapper<ClassName, __LINE__> : ClassName \
|
struct INTERNAL_CATCH_UNIQUE_NAME( Catch_FixtureWrapper ) : ClassName \
|
||||||
{ \
|
{ \
|
||||||
void test(); \
|
void test(); \
|
||||||
}; }\
|
}; \
|
||||||
namespace { Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar ) ( &Catch::FixtureWrapper<ClassName, __LINE__>::test, TestName, Desc ); } \
|
namespace{ Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar ) ( &INTERNAL_CATCH_UNIQUE_NAME( Catch_FixtureWrapper )::test, TestName, Desc ); } \
|
||||||
void Catch::FixtureWrapper<ClassName, __LINE__>::test()
|
void INTERNAL_CATCH_UNIQUE_NAME( Catch_FixtureWrapper )::test()
|
||||||
|
|
||||||
#endif // TWOBLUECUBES_CATCH_REGISTRY_HPP_INCLUDED
|
#endif // TWOBLUECUBES_CATCH_REGISTRY_HPP_INCLUDED
|
||||||
|
Loading…
Reference in New Issue
Block a user