Add test for move-only type in `Action` signature

PiperOrigin-RevId: 616031018
Change-Id: Ie724f9562174387eab866a824d28106f344c558d
pull/4490/head
Abseil Team 8 months ago committed by Copybara-Service
parent b479e7a3c1
commit c231e6f5b1
  1. 16
      googlemock/test/gmock-more-actions_test.cc

@ -828,6 +828,22 @@ TEST(InvokeArgumentTest, ByExplicitConstReferenceFunction) {
EXPECT_FALSE(a.Perform(std::make_tuple(&ReferencesGlobalDouble)));
}
TEST(InvokeArgumentTest, MoveOnlyType) {
struct Marker {};
struct {
// Method takes a unique_ptr (to a type we don't care about), and an
// invocable type.
MOCK_METHOD(bool, MockMethod,
(std::unique_ptr<Marker>, std::function<int()>), ());
} mock;
ON_CALL(mock, MockMethod(_, _)).WillByDefault(InvokeArgument<1>());
// This compiles, but is a little opaque as a workaround:
ON_CALL(mock, MockMethod(_, _))
.WillByDefault(WithArg<1>(InvokeArgument<0>()));
}
// Tests DoAll(a1, a2).
TEST(DoAllTest, TwoActions) {
int n = 0;

Loading…
Cancel
Save