Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
yangql
googletest
Commits
c0dd0817
Commit
c0dd0817
authored
Mar 24, 2021
by
Abseil Team
Committed by
Dino Radaković
Mar 25, 2021
Browse files
Googletest export
Clarify explanation of mocking free functions PiperOrigin-RevId: 364943561
parent
66836f0a
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
+3
-3
docs/gmock_cook_book.md
docs/gmock_cook_book.md
+3
-3
No files found.
docs/gmock_cook_book.md
View file @
c0dd0817
...
...
@@ -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:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment