Googletest export

Docs: Clarify that expectations must be set before mocks are exercised
PiperOrigin-RevId: 373644072
This commit is contained in:
Abseil Team
2021-05-13 13:15:34 -07:00
committed by Dino Radaković
parent 662fe38e44
commit eb6e9273dc
3 changed files with 25 additions and 29 deletions

View File

@@ -344,6 +344,11 @@ Mock::VerifyAndClearExpectations(&mock_obj);
Mock::VerifyAndClear(&mock_obj);
```
Do not set new expectations after verifying and clearing a mock after its use.
Setting expectations after code that exercises the mock has undefined behavior.
See [Using Mocks in Tests](gmock_for_dummies.md#using-mocks-in-tests) for more
information.
You can also tell gMock that a mock object can be leaked and doesn't need to be
verified: