Added support for move only types to constraints

Therefore mock::retrieve now supports std::unique_ptr.
This commit is contained in:
Mathieu Champlon 2018-03-12 08:26:18 +01:00
parent 5795f4be70
commit bccd3ff303
8 changed files with 60 additions and 19 deletions

View file

@ -721,4 +721,25 @@ BOOST_FIXTURE_TEST_CASE( std_unique_ptr_argument_is_supported_in_equal_constrain
}
}
BOOST_FIXTURE_TEST_CASE( std_unique_ptr_argument_is_supported_in_retrieve_constraint, mock_error_fixture )
{
{
MOCK_FUNCTOR( f, void( std::unique_ptr< int > ) );
MOCK_EXPECT( f ).once().with( nullptr );
f( 0 );
CHECK_CALLS( 1 );
}
{
std::unique_ptr< int > i;
MOCK_FUNCTOR( f, void( std::unique_ptr< int > ) );
MOCK_EXPECT( f ).once().with( mock::retrieve( i ) );
std::unique_ptr< int > j( new int( 7 ) );
f( std::move( j ) );
BOOST_CHECK( !j );
BOOST_REQUIRE( i );
BOOST_CHECK_EQUAL( 7, *i );
CHECK_CALLS( 1 );
}
}
#endif