Add tests for MockFunction deduction (#2277)

Add tests checking that ::testing::MockFunction template argument can
be deduced in a function call context. This is a property raised in the
review, however, not checked before by any tests.
pull/2350/head
Adam Badura 5 years ago
parent 482ac6ee63
commit e41f31f2af
  1. 30
      googlemock/test/gmock-function-mocker_test.cc

@ -779,6 +779,36 @@ TEST(MockMethodMockFunctionTest, AsStdFunctionWithReferenceParameter) {
}
namespace {
template <typename Expected, typename F>
static constexpr bool IsMockFunctionTemplateArgumentDeducedTo(const MockFunction<F>&) {
return std::is_same<F, Expected>::value;
}
} // namespace
template <typename F>
class MockMethodMockFunctionSignatureTest : public Test {
};
using MockMethodMockFunctionSignatureTypes = Types<
void(),
int(),
void(int),
int(int),
int(bool, int),
int(bool, char, int, int, int, int, int, char, int, bool)
>;
TYPED_TEST_SUITE(MockMethodMockFunctionSignatureTest, MockMethodMockFunctionSignatureTypes);
TYPED_TEST(MockMethodMockFunctionSignatureTest, IsMockFunctionTemplateArgumentDeduced) {
using Argument = TypeParam;
MockFunction<Argument> foo;
EXPECT_TRUE(IsMockFunctionTemplateArgumentDeducedTo<Argument>(foo));
}
struct MockMethodSizes0 {
MOCK_METHOD(void, func, ());
};

Loading…
Cancel
Save