mirror of
https://github.com/google/googletest.git
synced 2024-12-27 10:11:03 +08:00
Googletest export
Clarify explanation of mocking free functions PiperOrigin-RevId: 364943561
This commit is contained in:
parent
66836f0a90
commit
c0dd0817cf
@ -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:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user