From 77962730563eece3525f40b8769e4ca0c6baf64c Mon Sep 17 00:00:00 2001 From: Marco Bubke <30830880+marbub@users.noreply.github.com> Date: Tue, 2 Oct 2018 11:31:21 -0400 Subject: Merge 86fe8a25eb5a6e4546f9e39cf23a5c764217bf85 into 440527a61e1c91188195f7de212c63c77e8f0a45 Closes #1867 PiperOrigin-RevId: 215392714 --- googlemock/test/gmock-generated-function-mockers_test.cc | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'googlemock/test/gmock-generated-function-mockers_test.cc') diff --git a/googlemock/test/gmock-generated-function-mockers_test.cc b/googlemock/test/gmock-generated-function-mockers_test.cc index f16833b2..4c490694 100644 --- a/googlemock/test/gmock-generated-function-mockers_test.cc +++ b/googlemock/test/gmock-generated-function-mockers_test.cc @@ -617,6 +617,17 @@ TEST(MockFunctionTest, AsStdFunctionReturnsReference) { value = 2; EXPECT_EQ(2, ref); } + +TEST(MockFunctionTest, AsStdFunctionWithReferenceParameter) { + MockFunction foo; + auto call = [](const std::function &f, int &i) { + return f(i); + }; + int i = 42; + EXPECT_CALL(foo, Call(i)).WillOnce(Return(-1)); + EXPECT_EQ(-1, call(foo.AsStdFunction(), i)); +} + #endif // GTEST_HAS_STD_FUNCTION_ struct MockMethodSizes0 { -- cgit v1.2.1