diff options
author | Abseil Team <absl-team@google.com> | 2018-10-25 02:04:43 (GMT) |
---|---|---|
committer | Gennadiy Civil <misterg@google.com> | 2018-10-26 18:19:59 (GMT) |
commit | b57c703963be1ca9749b902c49083beac56648aa (patch) | |
tree | b7f5433fce3803d121c9963dc69bcdeec4d35f7c /googlemock/test/gmock-matchers_test.cc | |
parent | a50e4f05b3d84c6a014c59a24263328242cc8236 (diff) | |
download | googletest-b57c703963be1ca9749b902c49083beac56648aa.zip googletest-b57c703963be1ca9749b902c49083beac56648aa.tar.gz googletest-b57c703963be1ca9749b902c49083beac56648aa.tar.bz2 |
Googletest export
Remove linked_ptr and use std::shared_ptr instead
PiperOrigin-RevId: 218618184
Diffstat (limited to 'googlemock/test/gmock-matchers_test.cc')
-rw-r--r-- | googlemock/test/gmock-matchers_test.cc | 32 |
1 files changed, 26 insertions, 6 deletions
diff --git a/googlemock/test/gmock-matchers_test.cc b/googlemock/test/gmock-matchers_test.cc index 45006bf..f4e9e9f 100644 --- a/googlemock/test/gmock-matchers_test.cc +++ b/googlemock/test/gmock-matchers_test.cc @@ -143,11 +143,13 @@ using testing::internal::ExplainMatchFailureTupleTo; using testing::internal::FloatingEqMatcher; using testing::internal::FormatMatcherDescription; using testing::internal::IsReadableTypeName; +using testing::internal::linked_ptr; using testing::internal::MatchMatrix; using testing::internal::RE; using testing::internal::scoped_ptr; using testing::internal::StreamMatchResultListener; using testing::internal::Strings; +using testing::internal::linked_ptr; using testing::internal::scoped_ptr; using testing::internal::string; @@ -1175,6 +1177,24 @@ TEST(IsNullTest, MatchesNullPointer) { #endif } +TEST(IsNullTest, LinkedPtr) { + const Matcher<linked_ptr<int> > m = IsNull(); + const linked_ptr<int> null_p; + const linked_ptr<int> non_null_p(new int); + + EXPECT_TRUE(m.Matches(null_p)); + EXPECT_FALSE(m.Matches(non_null_p)); +} + +TEST(IsNullTest, ReferenceToConstLinkedPtr) { + const Matcher<const linked_ptr<double>&> m = IsNull(); + const linked_ptr<double> null_p; + const linked_ptr<double> non_null_p(new double); + + EXPECT_TRUE(m.Matches(null_p)); + EXPECT_FALSE(m.Matches(non_null_p)); +} + #if GTEST_LANG_CXX11 TEST(IsNullTest, StdFunction) { const Matcher<std::function<void()>> m = IsNull(); @@ -1206,18 +1226,18 @@ TEST(NotNullTest, MatchesNonNullPointer) { } TEST(NotNullTest, LinkedPtr) { - const Matcher<std::shared_ptr<int>> m = NotNull(); - const std::shared_ptr<int> null_p; - const std::shared_ptr<int> non_null_p(new int); + const Matcher<linked_ptr<int> > m = NotNull(); + const linked_ptr<int> null_p; + const linked_ptr<int> non_null_p(new int); EXPECT_FALSE(m.Matches(null_p)); EXPECT_TRUE(m.Matches(non_null_p)); } TEST(NotNullTest, ReferenceToConstLinkedPtr) { - const Matcher<const std::shared_ptr<double>&> m = NotNull(); - const std::shared_ptr<double> null_p; - const std::shared_ptr<double> non_null_p(new double); + const Matcher<const linked_ptr<double>&> m = NotNull(); + const linked_ptr<double> null_p; + const linked_ptr<double> non_null_p(new double); EXPECT_FALSE(m.Matches(null_p)); EXPECT_TRUE(m.Matches(non_null_p)); |