Adress review comments

This commit is contained in:
Alexander Grund 2020-09-24 22:50:22 +02:00
parent 279bb2c767
commit c7873cde4b
No known key found for this signature in database
GPG key ID: AA48A0760367A42B
13 changed files with 36 additions and 48 deletions

View file

@ -24,7 +24,7 @@
<< ')' \
<< lazy_expectations( this )
#define MOCK_MOVE(z, n, d) \
#define MOCK_FORWARD(z, n, d) \
std::forward< T##n >( t##n )
namespace mock
@ -229,7 +229,7 @@ namespace detail
for( const auto& expectation: expectations_ )
{
if( expectation.is_valid(
BOOST_PP_ENUM(MOCK_NUM_ARGS, MOCK_MOVE, _) ) )
BOOST_PP_ENUM(MOCK_NUM_ARGS, MOCK_FORWARD, _) ) )
{
if( ! expectation.invoke() )
{
@ -247,7 +247,7 @@ namespace detail
error_type::call( MOCK_FUNCTION_CONTEXT, expectation.file(), expectation.line() );
if( expectation.functor() )
return expectation.functor()(
BOOST_PP_ENUM(MOCK_NUM_ARGS, MOCK_MOVE, _) );
BOOST_PP_ENUM(MOCK_NUM_ARGS, MOCK_FORWARD, _) );
return expectation.trigger();
}
}
@ -314,4 +314,4 @@ namespace detail
#undef MOCK_FUNCTION_FORMAT
#undef MOCK_FUNCTION_CONTEXT
#undef MOCK_MOVE
#undef MOCK_FORWARD

View file

@ -8,7 +8,7 @@
#include "function_impl_template.hpp"
#define MOCK_MOVE(z, n, d) \
#define MOCK_FORWARD(z, n, d) \
std::forward< T##n >( t##n )
namespace mock
@ -65,7 +65,7 @@ namespace detail
R operator()(
BOOST_PP_ENUM_BINARY_PARAMS(MOCK_NUM_ARGS, T, t) ) const
{
return (*impl_)( BOOST_PP_ENUM(MOCK_NUM_ARGS, MOCK_MOVE, _) );
return (*impl_)( BOOST_PP_ENUM(MOCK_NUM_ARGS, MOCK_FORWARD, _) );
}
friend std::ostream& operator<<( std::ostream& s, const function& f )
@ -94,4 +94,4 @@ namespace detail
}
} // mock
#undef MOCK_MOVE
#undef MOCK_FORWARD

View file

@ -47,8 +47,7 @@
#define MOCK_FUNCTOR(f, ...) \
mock::detail::functor< MOCK_FUNCTION_TYPE(__VA_ARGS__) > f, f##_mock
/// MOCK_FUNCTOR_TPL( name, signature )
/// Deprecated. Same as MOCK_FUNCTOR
#define MOCK_FUNCTOR_TPL(f, ...) MOCK_FUNCTOR(f, __VA_ARGS__)
#define MOCK_FUNCTOR_TPL(f, ...) static_assert(false, "MOCK_FUNCTOR_TPL has been replaced by MOCK_FUNCTOR")
#define MOCK_HELPER(t) \
t##_mock( mock::detail::root, BOOST_PP_STRINGIZE(t) )