mirror of
https://github.com/google/googletest.git
synced 2025-03-10 17:36:10 +00:00
Tests NotNull/IsNull with testing::internal::scoped_ptr.
This commit is contained in:
parent
b006f165b1
commit
e56daa7de1
@ -122,6 +122,7 @@ using testing::internal::kInvalidInterpolation;
|
|||||||
using testing::internal::kPercentInterpolation;
|
using testing::internal::kPercentInterpolation;
|
||||||
using testing::internal::kTupleInterpolation;
|
using testing::internal::kTupleInterpolation;
|
||||||
using testing::internal::linked_ptr;
|
using testing::internal::linked_ptr;
|
||||||
|
using testing::internal::scoped_ptr;
|
||||||
using testing::internal::string;
|
using testing::internal::string;
|
||||||
|
|
||||||
#ifdef GMOCK_HAS_REGEX
|
#ifdef GMOCK_HAS_REGEX
|
||||||
@ -734,6 +735,15 @@ TEST(IsNullTest, ReferenceToConstLinkedPtr) {
|
|||||||
EXPECT_FALSE(m.Matches(non_null_p));
|
EXPECT_FALSE(m.Matches(non_null_p));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST(IsNullTest, ReferenceToConstScopedPtr) {
|
||||||
|
const Matcher<const scoped_ptr<double>&> m = IsNull();
|
||||||
|
const scoped_ptr<double> null_p;
|
||||||
|
const scoped_ptr<double> non_null_p(new double);
|
||||||
|
|
||||||
|
EXPECT_TRUE(m.Matches(null_p));
|
||||||
|
EXPECT_FALSE(m.Matches(non_null_p));
|
||||||
|
}
|
||||||
|
|
||||||
// Tests that IsNull() describes itself properly.
|
// Tests that IsNull() describes itself properly.
|
||||||
TEST(IsNullTest, CanDescribeSelf) {
|
TEST(IsNullTest, CanDescribeSelf) {
|
||||||
Matcher<int*> m = IsNull();
|
Matcher<int*> m = IsNull();
|
||||||
@ -773,6 +783,15 @@ TEST(NotNullTest, ReferenceToConstLinkedPtr) {
|
|||||||
EXPECT_TRUE(m.Matches(non_null_p));
|
EXPECT_TRUE(m.Matches(non_null_p));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST(NotNullTest, ReferenceToConstScopedPtr) {
|
||||||
|
const Matcher<const scoped_ptr<double>&> m = NotNull();
|
||||||
|
const scoped_ptr<double> null_p;
|
||||||
|
const scoped_ptr<double> non_null_p(new double);
|
||||||
|
|
||||||
|
EXPECT_FALSE(m.Matches(null_p));
|
||||||
|
EXPECT_TRUE(m.Matches(non_null_p));
|
||||||
|
}
|
||||||
|
|
||||||
// Tests that NotNull() describes itself properly.
|
// Tests that NotNull() describes itself properly.
|
||||||
TEST(NotNullTest, CanDescribeSelf) {
|
TEST(NotNullTest, CanDescribeSelf) {
|
||||||
Matcher<int*> m = NotNull();
|
Matcher<int*> m = NotNull();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user