Googletest export

gMock Cookbook: Fix incorrect comment about EXPECT priority order

It's actually the last matching expectation that's used, not the first.

PiperOrigin-RevId: 316490770
This commit is contained in:
Abseil Team 2020-06-15 13:15:38 -04:00 committed by Andy Getz
parent 8567b09290
commit 549c5d061e

View File

@ -1675,11 +1675,11 @@ times from calling it with the wrong arguments.
### Expecting Ordered Calls {#OrderedCalls} ### Expecting Ordered Calls {#OrderedCalls}
Although an `EXPECT_CALL()` statement defined earlier takes precedence when Although an `EXPECT_CALL()` statement defined later takes precedence when gMock
gMock tries to match a function call with an expectation, by default calls don't tries to match a function call with an expectation, by default calls don't have
have to happen in the order `EXPECT_CALL()` statements are written. For example, to happen in the order `EXPECT_CALL()` statements are written. For example, if
if the arguments match the matchers in the third `EXPECT_CALL()`, but not those the arguments match the matchers in the second `EXPECT_CALL()`, but not those in
in the first two, then the third expectation will be used. the first and third, then the second expectation will be used.
If you would rather have all calls occur in the order of the expectations, put If you would rather have all calls occur in the order of the expectations, put
the `EXPECT_CALL()` statements in a block where you define a variable of type the `EXPECT_CALL()` statements in a block where you define a variable of type