mirror of
https://github.com/google/googletest.git
synced 2026-07-30 16:26:24 +08:00
Merge 04e9129ce6c070c631a429f6ca6cc0ea84c70c54 into a0f06a70e3da7afa88da9527c43951bca1f7cef2
This commit is contained in:
commit
dd9b594709
@ -457,6 +457,21 @@ TEST(...) {
|
|||||||
// is called.
|
// is called.
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
The default behavior for mock objects in gMock is *naggy*. That is, if you use
|
||||||
|
`MockFoo` directly (without wrapping it in `NiceMock` or `StrictMock`),
|
||||||
|
uninteresting calls will be allowed but will generate warnings.
|
||||||
|
|
||||||
|
You can also explicitly state this behavior using `NaggyMock`:
|
||||||
|
|
||||||
|
```cpp
|
||||||
|
using ::testing::NaggyMock;
|
||||||
|
|
||||||
|
TEST(...) {
|
||||||
|
NaggyMock<MockFoo> mock_foo;
|
||||||
|
EXPECT_CALL(mock_foo, DoThis());
|
||||||
|
... code that uses mock_foo ...
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
{: .callout .note}
|
{: .callout .note}
|
||||||
NOTE: `NiceMock` and `StrictMock` only affects *uninteresting* calls (calls of
|
NOTE: `NiceMock` and `StrictMock` only affects *uninteresting* calls (calls of
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user