mirror of
https://github.com/mat007/turtle.git
synced 2026-06-22 12:13:43 +00:00
Merge f872785e26 into afffdb470a
This commit is contained in:
commit
a74e5f9e45
3 changed files with 18 additions and 0 deletions
|
|
@ -13,6 +13,7 @@ Not yet released
|
|||
* Fixed mocking of a function returning a reference for gcc 4.1
|
||||
* Added MOCK_NO_AUTO_PTR to deactivate std::auto_ptr support
|
||||
* Added [@https://github.com/philsquared/Catch Catch] integration
|
||||
* Added support for movable objects in mock::retrieve
|
||||
|
||||
[endsect]
|
||||
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@
|
|||
#include "detail/addressof.hpp"
|
||||
#include <boost/ref.hpp>
|
||||
#include <boost/version.hpp>
|
||||
#include <boost/move/move.hpp>
|
||||
#include <boost/utility/enable_if.hpp>
|
||||
#include <boost/type_traits/common_type.hpp>
|
||||
#include <boost/type_traits/is_convertible.hpp>
|
||||
|
|
@ -157,6 +158,12 @@ namespace detail
|
|||
*expected_ = detail::addressof( actual );
|
||||
return true;
|
||||
}
|
||||
template< typename Actual >
|
||||
bool operator()( BOOST_RV_REF( Actual ) actual ) const
|
||||
{
|
||||
*expected_ = boost::move( actual );
|
||||
return true;
|
||||
}
|
||||
friend std::ostream& operator<<( std::ostream& s, const retrieve& r )
|
||||
{
|
||||
return s << "retrieve( " << mock::format( *r.expected_ ) << " )";
|
||||
|
|
|
|||
|
|
@ -219,6 +219,16 @@ BOOST_AUTO_TEST_CASE( retrieve_constraint )
|
|||
BOOST_CHECK_EQUAL( i, &j );
|
||||
}
|
||||
#endif
|
||||
#ifdef MOCK_SMART_PTR
|
||||
{
|
||||
std::unique_ptr< int > i;
|
||||
std::unique_ptr< int > j( new int( 3 ) );
|
||||
BOOST_CHECK( mock::retrieve( i ).c_( j ) );
|
||||
BOOST_REQUIRE( i );
|
||||
BOOST_CHECK_EQUAL( 3, *i );
|
||||
BOOST_CHECK( !j );
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
namespace
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue