diff options
author | Abseil Team <absl-team@google.com> | 2019-10-17 16:14:42 -0400 |
---|---|---|
committer | Andy Soffer <asoffer@google.com> | 2019-10-18 11:33:59 -0400 |
commit | 1f9edcd9698162b48d94e1ef2e6a2ab7ab4e6c56 (patch) | |
tree | 242ff712a09fb700a96ae10da78e3407f3d153d3 /googlemock/test | |
parent | bbe4b7363bbaa7c9e07dbacde11602a4c69504d3 (diff) | |
download | googletest-1f9edcd9698162b48d94e1ef2e6a2ab7ab4e6c56.tar.gz googletest-1f9edcd9698162b48d94e1ef2e6a2ab7ab4e6c56.tar.bz2 googletest-1f9edcd9698162b48d94e1ef2e6a2ab7ab4e6c56.zip |
Googletest export
Addressing https://github.com/google/googletest/issues/2502
Add MOCK_METHOD support for returning function pointers.
PiperOrigin-RevId: 275323671
Diffstat (limited to 'googlemock/test')
-rw-r--r-- | googlemock/test/gmock-function-mocker_test.cc | 7 |
1 files changed, 7 insertions, 0 deletions
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<int, std::string>& a_map) = 0; virtual int TypeWithTemplatedCopyCtor(const TemplatedCopyable<int>&) = 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<int>&)); // 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))); |