diff options
Diffstat (limited to 'googlemock/test/gmock-generated-function-mockers_test.cc')
-rw-r--r-- | googlemock/test/gmock-generated-function-mockers_test.cc | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/googlemock/test/gmock-generated-function-mockers_test.cc b/googlemock/test/gmock-generated-function-mockers_test.cc index 52d9b8b8..f07226c0 100644 --- a/googlemock/test/gmock-generated-function-mockers_test.cc +++ b/googlemock/test/gmock-generated-function-mockers_test.cc @@ -63,6 +63,15 @@ using testing::Return; using testing::ReturnRef; using testing::TypedEq; +template<typename T> +class TemplatedCopyable { + public: + TemplatedCopyable() {} + + template <typename U> + TemplatedCopyable(const U& other) {} // NOLINT +}; + class FooInterface { public: virtual ~FooInterface() {} @@ -91,6 +100,8 @@ class FooInterface { virtual int TypeWithHole(int (*func)()) = 0; virtual int TypeWithComma(const std::map<int, std::string>& a_map) = 0; + virtual int TypeWithTemplatedCopyCtor( + const TemplatedCopyable<int>& a_vector) = 0; #if GTEST_OS_WINDOWS STDMETHOD_(int, CTNullary)() = 0; @@ -146,6 +157,8 @@ class MockFoo : public FooInterface { MOCK_METHOD1(TypeWithHole, int(int (*)())); // NOLINT MOCK_METHOD1(TypeWithComma, int(const std::map<int, std::string>&)); // NOLINT + MOCK_METHOD1(TypeWithTemplatedCopyCtor, + int(const TemplatedCopyable<int>&)); // NOLINT #if GTEST_OS_WINDOWS MOCK_METHOD0_WITH_CALLTYPE(STDMETHODCALLTYPE, CTNullary, int()); @@ -288,6 +301,11 @@ TEST_F(FunctionMockerTest, MocksReturnTypeWithComma) { EXPECT_EQ(a_map, mock_foo_.ReturnTypeWithComma(42)); } +TEST_F(FunctionMockerTest, MocksTypeWithTemplatedCopyCtor) { + EXPECT_CALL(mock_foo_, TypeWithTemplatedCopyCtor(_)).WillOnce(Return(true)); + EXPECT_TRUE(foo_->TypeWithTemplatedCopyCtor(TemplatedCopyable<int>())); +} + #if GTEST_OS_WINDOWS // Tests mocking a nullary function with calltype. TEST_F(FunctionMockerTest, MocksNullaryFunctionWithCallType) { |