aboutsummaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorAbseil Team <absl-team@google.com>2023-01-18 09:43:14 -0800
committerCopybara-Service <copybara-worker@google.com>2023-01-18 09:43:56 -0800
commitec25eea8f8237cf86c30703f59747e42f34b6f75 (patch)
tree462e2de0efadf706c0cdce8a4751e2dac901705d /docs
parentbdb3b0a4939228f28fcb38e786cc29b79db463ab (diff)
downloadgoogletest-ec25eea8f8237cf86c30703f59747e42f34b6f75.zip
googletest-ec25eea8f8237cf86c30703f59747e42f34b6f75.tar.gz
googletest-ec25eea8f8237cf86c30703f59747e42f34b6f75.tar.bz2
Mention using MockFunction as a way to mock free functions.
PiperOrigin-RevId: 502901538 Change-Id: I0cf351b9ad1411ae9c45e09550c24e006a24e179
Diffstat (limited to 'docs')
-rw-r--r--docs/gmock_cook_book.md4
1 files changed, 4 insertions, 0 deletions
diff --git a/docs/gmock_cook_book.md b/docs/gmock_cook_book.md
index fc7db35..d11282f 100644
--- a/docs/gmock_cook_book.md
+++ b/docs/gmock_cook_book.md
@@ -285,6 +285,10 @@ If you are concerned about the performance overhead incurred by virtual
functions, and profiling confirms your concern, you can combine this with the
recipe for [mocking non-virtual methods](#MockingNonVirtualMethods).
+Alternatively, instead of introducing a new interface, you can rewrite your code
+to accept a std::function instead of the free function, and then use
+[MockFunction](#MockFunction) to mock the std::function.
+
### Old-Style `MOCK_METHODn` Macros
Before the generic `MOCK_METHOD` macro