summaryrefslogtreecommitdiff
path: root/test/gmock-generated-function-mockers_test.cc
diff options
context:
space:
mode:
Diffstat (limited to 'test/gmock-generated-function-mockers_test.cc')
-rw-r--r--test/gmock-generated-function-mockers_test.cc10
1 files changed, 10 insertions, 0 deletions
diff --git a/test/gmock-generated-function-mockers_test.cc b/test/gmock-generated-function-mockers_test.cc
index 18f19d8..a86a613 100644
--- a/test/gmock-generated-function-mockers_test.cc
+++ b/test/gmock-generated-function-mockers_test.cc
@@ -606,6 +606,16 @@ TEST(MockFunctionTest, AsStdFunction) {
EXPECT_EQ(-1, call(foo.AsStdFunction(), 1));
EXPECT_EQ(-2, call(foo.AsStdFunction(), 2));
}
+
+TEST(MockFunctionTest, AsStdFunctionReturnsReference) {
+ MockFunction<int&()> foo;
+ int value = 1;
+ EXPECT_CALL(foo, Call()).WillOnce(ReturnRef(value));
+ int& ref = foo.AsStdFunction()();
+ EXPECT_EQ(1, ref);
+ value = 2;
+ EXPECT_EQ(2, ref);
+}
#endif // GTEST_HAS_STD_FUNCTION_
} // namespace gmock_generated_function_mockers_test