Updates the gMock cheat sheet to include the versions of the Field and Property matchers which take an additional name parameter.
PiperOrigin-RevId: 353273968
Add a `Pointer` matcher as an analog to `Pointee`.
Similar to `Pointee`, `Pointer` works with either raw or smart pointers and
allows creating a matcher like Pointer(Eq(foo)) for smart pointers.
PiperOrigin-RevId: 346164768
Fix DoAll to work with move-only sink arguments.
This changes types of the first n - 1 actions so that they only get a readonly
view of the arguments. The last action will accept move only objects.
PiperOrigin-RevId: 327031893
Fix DoAll to work with move-only sink arguments.
This changes types of the first n - 1 actions so that they only get a readonly
view of the arguments. The last action will accept move only objects.
PiperOrigin-RevId: 324619666
Fix DoAll to work with move-only sink arguments.
This changes types of the first n - 1 actions so that they only get a readonly
view of the arguments. The last action will accept move only objects.
PiperOrigin-RevId: 324600664
Note that EXPECT_EQ(actual_value, expected_value) or EXPECT_THAT(actual_value, Eq(expected_value)) is preferred over EXPECT_THAT(actual_value, expected_value).
PiperOrigin-RevId: 314350852
Fix `-Wgnu-zero-variadic-macro-arguments` in GMock
Passing zero arguments to the variadic part of a macro is a GNU
extension and triggers warnings when build projects using GMock with
`-pedantic`.
- Fix uses of `GMOCK_PP_INTERNAL_16TH` to always receive at least 17
arguments. (this was triggered when `GMOCK_PP_NARG` or `GMOCK_PP_HAS_COMMA`
were used with an argument containing no commas).
- Fix `GMOCK_PP_HEAD` to append a dummy unused argument so that
`GMOCK_PP_INTERNAL_HEAD` always has two arguments.
PiperOrigin-RevId: 310414611
Clarify use of IsTrue and IsFalse matchers.
These matchers are subtle and confusing: what are they for?
The docs in the code are clear, but not very accessible.
googletest/googlemock/include/gmock/gmock-more-matchers.h
PiperOrigin-RevId: 283393275
Add a breadcrumb about nullopt comparison near the Optional() matcher.
Also add a note about how otherwise-spurious 'Eq()' may be needed in some cases. Without this, something like Field(&MyStruct::optional_field_without_equals_equals, absl::nullopt) doesn't work - it converts the nullopt to an optional<> of the non-equalable type, and fails to select the operator==(optional<>, nullopt_t) overload. The Eq() lets the type persist later into the match.
PiperOrigin-RevId: 281305519
Add a matcher `testing::ReturnRoundRobin` which, on each call, returns the next element in the sequence, restarting at the beginning once it has reached the end.
PiperOrigin-RevId: 276312136
Rolling forward IsNan() matcher with fixes in test for -Wconversion issues. Use
std::nanf and std::nanl where appropriate.
PiperOrigin-RevId: 275523003
Move IsFalse/IsTrue to a more appropriate section in the gmock matchers cheat sheet.
I'm assuming their current placement within the "Container Matchers" list is a mistake -- they don't seem to be container related and would fit well with other generic matchers.
PiperOrigin-RevId: 268016027