From f2fe1ad574deb68bcc6a180baa04e8d5a846d284 Mon Sep 17 00:00:00 2001 From: mat007 Date: Sat, 9 Jul 2011 18:41:36 +0000 Subject: [PATCH] Fix git-svn-id: https://svn.code.sf.net/p/turtle/code/trunk@380 860be788-9bd5-4423-9f1e-828f051e677b --- src/libraries/turtle/function.hpp | 2 +- src/libraries/turtle/mock.hpp | 6 +++--- src/tests/turtle_test/integration_test.cpp | 17 +++++++++++++++++ 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/src/libraries/turtle/function.hpp b/src/libraries/turtle/function.hpp index 0546e34..d4528a5 100644 --- a/src/libraries/turtle/function.hpp +++ b/src/libraries/turtle/function.hpp @@ -95,7 +95,7 @@ namespace mock return s << *e.impl_; } - function& _( detail::context& c, const std::string& instance ) + function& _configure( detail::context& c, const std::string& instance ) { if( ! impl_->context_ ) c.add( *impl_ ); diff --git a/src/libraries/turtle/mock.hpp b/src/libraries/turtle/mock.hpp index 0bd586c..fa027a2 100644 --- a/src/libraries/turtle/mock.hpp +++ b/src/libraries/turtle/mock.hpp @@ -97,14 +97,14 @@ namespace detail mock::function< S > #define MOCK_MOCKER(o, t) \ - mock::detail::deref( o ).t( mock::detail::root, \ + mock::detail::deref( o ).t##configure( mock::detail::root, \ BOOST_PP_STRINGIZE(o) ) #define MOCK_ANONYMOUS_MOCKER(o, t) \ - mock::detail::deref( o ).t( mock::detail::root, "?" ) + mock::detail::deref( o ).t##configure( mock::detail::root, "?" ) #define MOCK_METHOD_EXPECTATION(S, t) \ mutable mock::function< S > t##expectation; \ - mock::function< S >& t( const mock::detail::context&, \ + mock::function< S >& t##configure( const mock::detail::context&, \ const std::string& instance ) const \ { \ mock::detail::configure( *this, t##expectation, instance, \ diff --git a/src/tests/turtle_test/integration_test.cpp b/src/tests/turtle_test/integration_test.cpp index a98804c..f226401 100644 --- a/src/tests/turtle_test/integration_test.cpp +++ b/src/tests/turtle_test/integration_test.cpp @@ -421,3 +421,20 @@ BOOST_AUTO_TEST_CASE( boost_reference_wrapper_is_supported_in_value_constraint ) s = "string"; f( "string" ); } + +namespace +{ + template< typename T > + void nothing( T ) + {} + + struct member_pointer_mock_class + { + MOCK_CONST_METHOD_EXT( my_method, 0, void(), my_method ) + }; +} + +BOOST_AUTO_TEST_CASE( member_pointer_on_mock_method_is_valid ) +{ + nothing( &member_pointer_mock_class::my_method ); +}