From 1f9edcd9698162b48d94e1ef2e6a2ab7ab4e6c56 Mon Sep 17 00:00:00 2001 From: Abseil Team Date: Thu, 17 Oct 2019 16:14:42 -0400 Subject: Googletest export Addressing https://github.com/google/googletest/issues/2502 Add MOCK_METHOD support for returning function pointers. PiperOrigin-RevId: 275323671 --- googlemock/test/gmock-function-mocker_test.cc | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'googlemock/test') diff --git a/googlemock/test/gmock-function-mocker_test.cc b/googlemock/test/gmock-function-mocker_test.cc index fbc5d5b2..55be70a8 100644 --- a/googlemock/test/gmock-function-mocker_test.cc +++ b/googlemock/test/gmock-function-mocker_test.cc @@ -101,6 +101,10 @@ class FooInterface { virtual int TypeWithComma(const std::map& a_map) = 0; virtual int TypeWithTemplatedCopyCtor(const TemplatedCopyable&) = 0; + virtual int (*ReturnsFunctionPointer1(int))(bool) = 0; + using fn_ptr = int (*)(bool); + virtual fn_ptr ReturnsFunctionPointer2(int) = 0; + #if GTEST_OS_WINDOWS STDMETHOD_(int, CTNullary)() = 0; STDMETHOD_(bool, CTUnary)(int x) = 0; @@ -159,6 +163,9 @@ class MockFoo : public FooInterface { MOCK_METHOD(int, TypeWithTemplatedCopyCtor, (const TemplatedCopyable&)); // NOLINT + MOCK_METHOD(int (*)(bool), ReturnsFunctionPointer1, (int), ()); + MOCK_METHOD(fn_ptr, ReturnsFunctionPointer2, (int), ()); + #if GTEST_OS_WINDOWS MOCK_METHOD(int, CTNullary, (), (Calltype(STDMETHODCALLTYPE))); MOCK_METHOD(bool, CTUnary, (int), (Calltype(STDMETHODCALLTYPE))); -- cgit v1.2.3