diff options
author | Abseil Team <absl-team@google.com> | 2021-05-13 13:15:34 -0700 |
---|---|---|
committer | Dino Radaković <dinor@google.com> | 2021-05-18 13:48:14 -0700 |
commit | eb6e9273dcf9c6535abb45306afe558aa961e3c3 (patch) | |
tree | cab3eeb3190d3f79e40c81dcf8d608fff5345a98 /docs/gmock_for_dummies.md | |
parent | 662fe38e44900c007eccb65a5d2ea19df7bd520e (diff) | |
download | googletest-git-eb6e9273dcf9c6535abb45306afe558aa961e3c3.tar.gz |
Googletest export
Docs: Clarify that expectations must be set before mocks are exercised
PiperOrigin-RevId: 373644072
Diffstat (limited to 'docs/gmock_for_dummies.md')
-rw-r--r-- | docs/gmock_for_dummies.md | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/docs/gmock_for_dummies.md b/docs/gmock_for_dummies.md index 370f17e1..1f4cc246 100644 --- a/docs/gmock_for_dummies.md +++ b/docs/gmock_for_dummies.md @@ -262,8 +262,9 @@ when you allocate mocks on the heap. You get that automatically if you use the `gtest_main` library already. **Important note:** gMock requires expectations to be set **before** the mock -functions are called, otherwise the behavior is **undefined**. In particular, -you mustn't interleave `EXPECT_CALL()s` and calls to the mock functions. +functions are called, otherwise the behavior is **undefined**. Do not alternate +between calls to `EXPECT_CALL()` and calls to the mock functions, and do not set +any expectations on a mock after passing the mock to an API. This means `EXPECT_CALL()` should be read as expecting that a call will occur *in the future*, not that a call has occurred. Why does gMock work like that? |