git-svn-id: https://svn.code.sf.net/p/turtle/code/trunk@768 860be788-9bd5-4423-9f1e-828f051e677b
This commit is contained in:
mat007 2015-03-01 11:28:33 +00:00
parent 20be7d84d0
commit 96f5d1959a

View file

@ -38,9 +38,6 @@ namespace detail
{ {
public: public:
typedef safe_error< R, MOCK_ERROR_POLICY< R > > error_type; typedef safe_error< R, MOCK_ERROR_POLICY< R > > error_type;
typedef expectation<
R ( BOOST_PP_ENUM_PARAMS(MOCK_NUM_ARGS, T) )
> expectation_type;
public: public:
function_impl() function_impl()
@ -90,11 +87,14 @@ namespace detail
} }
private: private:
template< typename T > typedef expectation<
struct wrapper : wrapper_base< T, expectation_type > R( BOOST_PP_ENUM_PARAMS( MOCK_NUM_ARGS, T ) )
> expectation_type;
struct wrapper : wrapper_base< R, expectation_type >
{ {
wrapper( const boost::shared_ptr< mutex >& m, expectation_type& e ) wrapper( const boost::shared_ptr< mutex >& m, expectation_type& e )
: wrapper_base< T, expectation_type >( e ) : wrapper_base< R, expectation_type >( e )
, lock_( m ) , lock_( m )
{} {}
@ -178,21 +178,21 @@ namespace detail
}; };
public: public:
typedef wrapper< R > wrapper_type; typedef wrapper wrapper_type;
wrapper_type expect( const char* file, int line ) wrapper expect( const char* file, int line )
{ {
lock _( mutex_ ); lock _( mutex_ );
expectations_.push_back( expectation_type( file, line ) ); expectations_.push_back( expectation_type( file, line ) );
valid_ = true; valid_ = true;
return wrapper_type( mutex_, expectations_.back() ); return wrapper( mutex_, expectations_.back() );
} }
wrapper_type expect() wrapper expect()
{ {
lock _( mutex_ ); lock _( mutex_ );
expectations_.push_back( expectation_type() ); expectations_.push_back( expectation_type() );
valid_ = true; valid_ = true;
return wrapper_type( mutex_, expectations_.back() ); return wrapper( mutex_, expectations_.back() );
} }
R operator()( R operator()(