From e56daa7de1d85c35d1cdc252b500ab276b5c1c9c Mon Sep 17 00:00:00 2001 From: vladlosev Date: Wed, 18 Nov 2009 01:08:08 +0000 Subject: [PATCH] Tests NotNull/IsNull with testing::internal::scoped_ptr. --- test/gmock-matchers_test.cc | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/test/gmock-matchers_test.cc b/test/gmock-matchers_test.cc index 08cbcb64..919ce651 100644 --- a/test/gmock-matchers_test.cc +++ b/test/gmock-matchers_test.cc @@ -122,6 +122,7 @@ using testing::internal::kInvalidInterpolation; using testing::internal::kPercentInterpolation; using testing::internal::kTupleInterpolation; using testing::internal::linked_ptr; +using testing::internal::scoped_ptr; using testing::internal::string; #ifdef GMOCK_HAS_REGEX @@ -734,6 +735,15 @@ TEST(IsNullTest, ReferenceToConstLinkedPtr) { EXPECT_FALSE(m.Matches(non_null_p)); } +TEST(IsNullTest, ReferenceToConstScopedPtr) { + const Matcher&> m = IsNull(); + const scoped_ptr null_p; + const scoped_ptr non_null_p(new double); + + EXPECT_TRUE(m.Matches(null_p)); + EXPECT_FALSE(m.Matches(non_null_p)); +} + // Tests that IsNull() describes itself properly. TEST(IsNullTest, CanDescribeSelf) { Matcher m = IsNull(); @@ -773,6 +783,15 @@ TEST(NotNullTest, ReferenceToConstLinkedPtr) { EXPECT_TRUE(m.Matches(non_null_p)); } +TEST(NotNullTest, ReferenceToConstScopedPtr) { + const Matcher&> m = NotNull(); + const scoped_ptr null_p; + const scoped_ptr non_null_p(new double); + + EXPECT_FALSE(m.Matches(null_p)); + EXPECT_TRUE(m.Matches(non_null_p)); +} + // Tests that NotNull() describes itself properly. TEST(NotNullTest, CanDescribeSelf) { Matcher m = NotNull();