summaryrefslogtreecommitdiffstats
path: root/docs/gmock_cheat_sheet.md
diff options
context:
space:
mode:
authorAbseil Team <absl-team@google.com>2021-05-13 20:15:34 (GMT)
committerDino Radaković <dinor@google.com>2021-05-18 20:48:14 (GMT)
commiteb6e9273dcf9c6535abb45306afe558aa961e3c3 (patch)
treecab3eeb3190d3f79e40c81dcf8d608fff5345a98 /docs/gmock_cheat_sheet.md
parent662fe38e44900c007eccb65a5d2ea19df7bd520e (diff)
downloadgoogletest-eb6e9273dcf9c6535abb45306afe558aa961e3c3.zip
googletest-eb6e9273dcf9c6535abb45306afe558aa961e3c3.tar.gz
googletest-eb6e9273dcf9c6535abb45306afe558aa961e3c3.tar.bz2
Googletest export
Docs: Clarify that expectations must be set before mocks are exercised PiperOrigin-RevId: 373644072
Diffstat (limited to 'docs/gmock_cheat_sheet.md')
-rw-r--r--docs/gmock_cheat_sheet.md5
1 files changed, 5 insertions, 0 deletions
diff --git a/docs/gmock_cheat_sheet.md b/docs/gmock_cheat_sheet.md
index c1d1a50..2545c61 100644
--- a/docs/gmock_cheat_sheet.md
+++ b/docs/gmock_cheat_sheet.md
@@ -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: