From c0bc085943d58e5d830d70b22b8f9b8ccd325ba8 Mon Sep 17 00:00:00 2001 From: mat007 Date: Sun, 8 Jan 2012 22:50:42 +0000 Subject: [PATCH] Tweaks git-svn-id: https://svn.code.sf.net/p/turtle/code/trunk@391 860be788-9bd5-4423-9f1e-828f051e677b --- src/libraries/turtle/action.hpp | 3 +++ src/libraries/turtle/expectation.hpp | 6 +++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/libraries/turtle/action.hpp b/src/libraries/turtle/action.hpp index 754b69b..c36b6d2 100644 --- a/src/libraries/turtle/action.hpp +++ b/src/libraries/turtle/action.hpp @@ -36,6 +36,9 @@ namespace detail template< typename Value > void returns( Value v ) { + // if an error is generated by the line below it means a value + // passed to 'returns' was of the wrong type as it cannot be + // used to copy construct a Result r_.reset( new result_type( v ) ); f_ = lambda_type::make_val( boost::ref( *r_ ) ); } diff --git a/src/libraries/turtle/expectation.hpp b/src/libraries/turtle/expectation.hpp index abfa358..ae3bee1 100644 --- a/src/libraries/turtle/expectation.hpp +++ b/src/libraries/turtle/expectation.hpp @@ -174,7 +174,7 @@ namespace detail n \ >::type arg##n##_type; #define MOCK_EXPECTATION_CONSTRUCTOR(z, n, d) BOOST_PP_COMMA_IF(n) c##n##_( new detail::check< arg##n##_type, constraint< detail::any > >( mock::any ) ) -#define MOCK_EXPECTATION_WITH(z, n, d) c##n##_.reset( new detail::check< arg##n##_type, Constraint##n >( c##n ) ); +#define MOCK_EXPECTATION_WITH(z, n, d) c##n##_.reset( new detail::check< arg##n##_type, Constraint_##n >( c##n ) ); #define MOCK_EXPECTATION_MEMBER(z, n, d) boost::shared_ptr< detail::check_base< arg##n##_type > > c##n##_; #define MOCK_EXPECTATION_ARGS(z, n, d) BOOST_PP_COMMA_IF(n) arg##n##_type a##n #define MOCK_EXPECTATION_IS_VALID(z, n, d) && (*c##n##_)( a##n ) @@ -191,8 +191,8 @@ namespace detail expectation() \ : BOOST_PP_REPEAT(n, MOCK_EXPECTATION_CONSTRUCTOR, BOOST_PP_EMPTY) \ {} \ - template< BOOST_PP_ENUM_PARAMS(n, typename Constraint) > \ - expectation& with( BOOST_PP_ENUM_BINARY_PARAMS(n, Constraint, c) ) \ + template< BOOST_PP_ENUM_PARAMS(n, typename Constraint_) > \ + expectation& with( BOOST_PP_ENUM_BINARY_PARAMS(n, Constraint_, c) ) \ { \ BOOST_PP_REPEAT(n, MOCK_EXPECTATION_WITH, BOOST_PP_EMPTY) \ return *this; \