aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorkosak <kosak@google.com>2014-06-17 23:19:54 +0000
committerkosak <kosak@google.com>2014-06-17 23:19:54 +0000
commita9e02a9178d29446b77564dd59e995ec4acfeb11 (patch)
treee060848ef5bed0ebcd6eddf57e908b6fdf935403 /test
parent1f5fdea417f1a55cffcfc0711d345d1d8ca2bc01 (diff)
downloadgoogletest-a9e02a9178d29446b77564dd59e995ec4acfeb11.tar.gz
googletest-a9e02a9178d29446b77564dd59e995ec4acfeb11.tar.bz2
googletest-a9e02a9178d29446b77564dd59e995ec4acfeb11.zip
Add MockFunction::AsStdFunction(). Also pull in gtest 688.
Diffstat (limited to 'test')
-rw-r--r--test/gmock-generated-function-mockers_test.cc13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/gmock-generated-function-mockers_test.cc b/test/gmock-generated-function-mockers_test.cc
index 169ed5a2..14dded87 100644
--- a/test/gmock-generated-function-mockers_test.cc
+++ b/test/gmock-generated-function-mockers_test.cc
@@ -595,5 +595,18 @@ TEST(MockFunctionTest, WorksFor10Arguments) {
EXPECT_EQ(2, foo.Call(true, 'a', 0, 0, 0, 0, 0, 'b', 1, false));
}
+#if GTEST_LANG_CXX11
+TEST(MockFunctionTest, AsStdFunction) {
+ MockFunction<int(int)> foo;
+ auto call = [](const std::function<int(int)> &f, int i) {
+ return f(i);
+ };
+ EXPECT_CALL(foo, Call(1)).WillOnce(Return(-1));
+ EXPECT_CALL(foo, Call(2)).WillOnce(Return(-2));
+ EXPECT_EQ(-1, call(foo.AsStdFunction(), 1));
+ EXPECT_EQ(-2, call(foo.AsStdFunction(), 2));
+}
+#endif // GTEST_LANG_CXX11
+
} // namespace gmock_generated_function_mockers_test
} // namespace testing