aboutsummaryrefslogtreecommitdiffstats
path: root/test/gmock-actions_test.cc
diff options
context:
space:
mode:
authorkosak <kosak@google.com>2015-01-08 03:03:09 +0000
committerkosak <kosak@google.com>2015-01-08 03:03:09 +0000
commit53d49dc43ea3f34a61f4a017d33ac5a0b650a68d (patch)
treecaeeb19d2e1a04c16c23f0f46211a092c948f77f /test/gmock-actions_test.cc
parent8e838ce0fd145431b433f534c71bdb7f5d6b11ac (diff)
downloadgoogletest-53d49dc43ea3f34a61f4a017d33ac5a0b650a68d.tar.gz
googletest-53d49dc43ea3f34a61f4a017d33ac5a0b650a68d.tar.bz2
googletest-53d49dc43ea3f34a61f4a017d33ac5a0b650a68d.zip
Make ReturnNull() support unique_ptr and shared_ptr.
Diffstat (limited to 'test/gmock-actions_test.cc')
-rw-r--r--test/gmock-actions_test.cc12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/gmock-actions_test.cc b/test/gmock-actions_test.cc
index 8089a81d..a0551941 100644
--- a/test/gmock-actions_test.cc
+++ b/test/gmock-actions_test.cc
@@ -604,6 +604,18 @@ TEST(ReturnNullTest, WorksInPointerReturningFunction) {
EXPECT_TRUE(a2.Perform(make_tuple(true)) == NULL);
}
+#if GTEST_HAS_STD_UNIQUE_PTR_
+// Tests that ReturnNull() returns NULL for shared_ptr and unique_ptr returning
+// functions.
+TEST(ReturnNullTest, WorksInSmartPointerReturningFunction) {
+ const Action<std::unique_ptr<const int>()> a1 = ReturnNull();
+ EXPECT_TRUE(a1.Perform(make_tuple()) == nullptr);
+
+ const Action<std::shared_ptr<int>(std::string)> a2 = ReturnNull();
+ EXPECT_TRUE(a2.Perform(make_tuple("foo")) == nullptr);
+}
+#endif // GTEST_HAS_STD_UNIQUE_PTR_
+
// Tests that ReturnRef(v) works for reference types.
TEST(ReturnRefTest, WorksForReference) {
const int n = 0;