Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
googletest
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
googletest
Commits
c0dd0817
Commit
c0dd0817
authored
Mar 24, 2021
by
Abseil Team
Committed by
Dino Radaković
Mar 25, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Googletest export
Clarify explanation of mocking free functions PiperOrigin-RevId: 364943561
parent
66836f0a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
+3
-3
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.
...
@@ -251,9 +251,9 @@ tests.
### Mocking Free Functions
### Mocking Free Functions
It
's possible to use gMock to mock a free function (i.e. a C-style function or a
It
is not possible to directly mock a free function (i.e. a C-style function or
static method). You just need to rewrite your code to use an interface (abstract
a static method). If you need to, you can rewrite your code to use an interface
class).
(abstract
class).
Instead of calling a free function (say,
`OpenFile`
) directly, introduce an
Instead of calling a free function (say,
`OpenFile`
) directly, introduce an
interface for it and have a concrete subclass that calls the free function:
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