mirror of
https://github.com/mat007/turtle.git
synced 2026-06-22 12:13:43 +00:00
Strings are surrounded with " by mock::format
git-svn-id: https://svn.code.sf.net/p/turtle/code/trunk@11 860be788-9bd5-4423-9f1e-828f051e677b
This commit is contained in:
parent
1bee70f758
commit
a03f8d7ceb
6 changed files with 35 additions and 15 deletions
|
|
@ -46,7 +46,7 @@ namespace detail
|
|||
BOOST_DEDUCED_TYPENAME detail::is_functor< T >::type
|
||||
>::type* = 0 )
|
||||
: functor_( equal( t ).functor_ )
|
||||
, desc_ ( detail::format( t ) )
|
||||
, desc_ ( mock::format( t ) )
|
||||
{
|
||||
if( !functor_ )
|
||||
std::invalid_argument( "invalid functor" );
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ namespace mock
|
|||
const T& t )
|
||||
{
|
||||
return detail::placeholder< Functor >( f,
|
||||
name + "( " + detail::format( t ) + " )" );
|
||||
name + "( " + format( t ) + " )" );
|
||||
}
|
||||
|
||||
namespace detail
|
||||
|
|
|
|||
|
|
@ -130,9 +130,9 @@ namespace mock
|
|||
}
|
||||
|
||||
#define MOCK_EXPECTATION_PARAMETER(z, n, d) BOOST_PP_COMMA_IF(n) const_cast< A##n & >( a##n )
|
||||
#define MOCK_EXPECTATION_DETAIL(z, n, d) + ", " + detail::format( a##n )
|
||||
#define MOCK_EXPECTATION_DETAIL(z, n, d) + ", " + format( a##n )
|
||||
#define MOCK_EXPECTATION_PARAMETERS(n) \
|
||||
detail::format( a0 ) BOOST_PP_REPEAT_FROM_TO(1, n, MOCK_EXPECTATION_DETAIL, BOOST_PP_EMPTY)
|
||||
format( a0 ) BOOST_PP_REPEAT_FROM_TO(1, n, MOCK_EXPECTATION_DETAIL, BOOST_PP_EMPTY)
|
||||
#define MOCK_EXPECTATION_OPERATOR(z, n, d) \
|
||||
template< BOOST_PP_ENUM_PARAMS(n, typename A) > \
|
||||
result_type operator()( BOOST_PP_ENUM_BINARY_PARAMS(n, const A, & a) ) const \
|
||||
|
|
|
|||
|
|
@ -72,6 +72,20 @@ namespace detail
|
|||
return "?";
|
||||
}
|
||||
}
|
||||
|
||||
template< typename T >
|
||||
std::string format( const T& t )
|
||||
{
|
||||
return detail::format( t );
|
||||
}
|
||||
inline std::string format( const std::string& s )
|
||||
{
|
||||
return '"' + s + '"';
|
||||
}
|
||||
inline std::string format( const char* s )
|
||||
{
|
||||
return '"' + std::string( s ) + '"';
|
||||
}
|
||||
}
|
||||
|
||||
#endif // #ifndef MOCK_FORMAT_HPP_INCLUDED
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue