mirror of
https://github.com/mat007/turtle.git
synced 2026-06-22 12:13:43 +00:00
Added support for move only types to constraints
Therefore mock::retrieve now supports std::unique_ptr.
This commit is contained in:
parent
5795f4be70
commit
bccd3ff303
8 changed files with 60 additions and 19 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue