From c0dd0817cf2c7798a7e318e410a144a372166f91 Mon Sep 17 00:00:00 2001 From: Abseil Team Date: Wed, 24 Mar 2021 19:20:37 -0700 Subject: [PATCH] Googletest export Clarify explanation of mocking free functions PiperOrigin-RevId: 364943561 --- docs/gmock_cook_book.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/gmock_cook_book.md b/docs/gmock_cook_book.md index ed8376a8..a9f9edc0 100644 --- a/docs/gmock_cook_book.md +++ b/docs/gmock_cook_book.md @@ -251,9 +251,9 @@ tests. ### Mocking Free Functions -It's possible to use gMock to mock a free function (i.e. a C-style function or a -static method). You just need to rewrite your code to use an interface (abstract -class). +It is not possible to directly mock a free function (i.e. a C-style function or +a static method). If you need to, you can rewrite your code to use an interface +(abstract class). Instead of calling a free function (say, `OpenFile`) directly, introduce an interface for it and have a concrete subclass that calls the free function: