Fixed a regression with mock::any needing the parameter type to be defined instead of only declared

git-svn-id: https://svn.code.sf.net/p/turtle/code/trunk@190 860be788-9bd5-4423-9f1e-828f051e677b
This commit is contained in:
mat007 2011-01-15 10:03:31 +00:00
parent 28761038cc
commit f4ceb3cdfc
2 changed files with 17 additions and 2 deletions

View file

@ -25,7 +25,6 @@ namespace mock
template< typename Actual > \
bool operator()( const Actual& actual ) const \
{ \
(void)actual; \
return Expr; \
} \
friend std::ostream& operator<<( std::ostream& s, const N& ) \
@ -43,7 +42,7 @@ namespace mock
}; \
const constraint< detail::N > N;
MOCK_CONSTRAINT( any, true )
MOCK_CONSTRAINT( any, true && &actual )
MOCK_CONSTRAINT( negate, ! actual )
MOCK_CONSTRAINT( evaluate, actual() )

View file

@ -127,6 +127,22 @@ BOOST_AUTO_TEST_CASE( mock_object_method_const_disambiguation )
BOOST_CHECK_THROW( const_mock.my_method(), std::exception );
}
namespace
{
struct my_declared_but_undefined_type;
MOCK_CLASS( my_declared_but_undefined_mock )
{
MOCK_METHOD_EXT( m, 1, void( my_declared_but_undefined_type& ), m )
};
}
BOOST_AUTO_TEST_CASE( mock_object_method_with_declared_but_not_defined_parameter_is_valid )
{
my_declared_but_undefined_mock mock;
MOCK_EXPECT( mock, m );
}
BOOST_AUTO_TEST_CASE( mock_functor_in_function_is_supported )
{
boost::function< int( float, const std::string& ) > func;