mirror of
https://github.com/mat007/turtle.git
synced 2026-06-22 12:13:43 +00:00
Added a much better workaround to the comma-in-macro problem
git-svn-id: https://svn.code.sf.net/p/turtle/code/trunk@419 860be788-9bd5-4423-9f1e-828f051e677b
This commit is contained in:
parent
e725d1c006
commit
3fa0d17785
2 changed files with 22 additions and 2 deletions
|
|
@ -49,7 +49,10 @@ namespace detail
|
|||
{};
|
||||
|
||||
template< typename T >
|
||||
struct base
|
||||
struct base;
|
||||
|
||||
template< typename T >
|
||||
struct base< void( T ) > : T
|
||||
{
|
||||
typedef T base_type;
|
||||
};
|
||||
|
|
@ -78,7 +81,7 @@ namespace detail
|
|||
}
|
||||
|
||||
#define MOCK_BASE_CLASS(T, I) \
|
||||
struct T : I, mock::object, mock::detail::base< I >
|
||||
struct T : mock::detail::base< void( I ) >, mock::object
|
||||
#define MOCK_CLASS(T) \
|
||||
struct T : mock::object
|
||||
#define MOCK_FUNCTOR(f, S) \
|
||||
|
|
|
|||
|
|
@ -319,3 +319,20 @@ BOOST_AUTO_TEST_CASE( mock_static_function_is_named )
|
|||
{
|
||||
BOOST_CHECK_EQUAL( "static_function_class::mock_static_function", to_string( MOCK_MOCKER( static_function_class::mock_static_function ) ) );
|
||||
}
|
||||
|
||||
namespace
|
||||
{
|
||||
template< typename T1, typename T2 >
|
||||
struct base_template_class
|
||||
{};
|
||||
MOCK_BASE_CLASS( mock_instanciated_template_class, (base_template_class< int, int >) )
|
||||
{};
|
||||
template< typename T >
|
||||
MOCK_BASE_CLASS( mock_template_class, (base_template_class< T, T >) )
|
||||
{};
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE( mock_template_class_can_be_instanciated )
|
||||
{
|
||||
mock_template_class< int > c;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue