Removed limitation on the operator() of a custom constraint which was required to be const

git-svn-id: https://svn.code.sf.net/p/turtle/code/trunk@390 860be788-9bd5-4423-9f1e-828f051e677b
This commit is contained in:
mat007 2011-10-10 22:21:53 +00:00
parent dc27632f66
commit ee338d40bb
4 changed files with 23 additions and 35 deletions

View file

@ -413,6 +413,25 @@ BOOST_AUTO_TEST_CASE( using_custom_constraint )
BOOST_CHECK_EQUAL( expected, s.str() );
}
namespace
{
struct custom_constraint_with_non_const_operator
{
template< typename Actual >
bool operator()( Actual actual )
{
return actual == 42;
}
};
}
BOOST_AUTO_TEST_CASE( custom_constraint_function_operator_does_not_need_to_be_const )
{
MOCK_FUNCTOR( void( float ) ) f;
MOCK_EXPECT( f, _ ).with( mock::constraint< custom_constraint_with_non_const_operator >( custom_constraint_with_non_const_operator() ) );
f( 42 );
}
BOOST_AUTO_TEST_CASE( boost_reference_wrapper_is_supported_in_value_constraint )
{
MOCK_FUNCTOR( void( const std::string& ) ) f;