Googletest export

Move matchers reference from cheat sheet into its own document

PiperOrigin-RevId: 370749693
This commit is contained in:
Abseil Team
2021-04-27 16:22:33 -04:00
committed by Derek Mauro
parent 719fd2d36f
commit 680a5aa337
6 changed files with 301 additions and 300 deletions

View File

@@ -1184,11 +1184,12 @@ Hamcrest project, which adds `assertThat()` to JUnit.
### Using Predicates as Matchers
gMock provides a [built-in set](gmock_cheat_sheet.md#MatcherList) of matchers.
In case you find them lacking, you can use an arbitrary unary predicate function
or functor as a matcher - as long as the predicate accepts a value of the type
you want. You do this by wrapping the predicate inside the `Truly()` function,
for example:
gMock provides a set of built-in matchers for matching arguments with expected
values—see the [Matchers Reference](reference/matchers.md) for more information.
In case you find the built-in set lacking, you can use an arbitrary unary
predicate function or functor as a matcher - as long as the predicate accepts a
value of the type you want. You do this by wrapping the predicate inside the
`Truly()` function, for example:
```cpp
using ::testing::Truly;