From 79b83505bcf73bf2903ebf2e2f82cb1e1f181816 Mon Sep 17 00:00:00 2001 From: vladlosev Date: Wed, 18 Nov 2009 00:43:37 +0000 Subject: Updates IsNull and NotNull matchers to work with smart pointers. --- include/gmock/gmock-matchers.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'include') diff --git a/include/gmock/gmock-matchers.h b/include/gmock/gmock-matchers.h index 3d82279b..deb09463 100644 --- a/include/gmock/gmock-matchers.h +++ b/include/gmock/gmock-matchers.h @@ -633,12 +633,12 @@ GMOCK_IMPLEMENT_COMPARISON_MATCHER_(Ne, !=, "not equal to"); #undef GMOCK_IMPLEMENT_COMPARISON_MATCHER_ -// Implements the polymorphic IsNull() matcher, which matches any +// Implements the polymorphic IsNull() matcher, which matches any raw or smart // pointer that is NULL. class IsNullMatcher { public: - template - bool Matches(T* p) const { return p == NULL; } + template + bool Matches(const Pointer& p) const { return GetRawPointer(p) == NULL; } void DescribeTo(::std::ostream* os) const { *os << "is NULL"; } void DescribeNegationTo(::std::ostream* os) const { @@ -646,12 +646,12 @@ class IsNullMatcher { } }; -// Implements the polymorphic NotNull() matcher, which matches any +// Implements the polymorphic NotNull() matcher, which matches any raw or smart // pointer that is not NULL. class NotNullMatcher { public: - template - bool Matches(T* p) const { return p != NULL; } + template + bool Matches(const Pointer& p) const { return GetRawPointer(p) != NULL; } void DescribeTo(::std::ostream* os) const { *os << "is not NULL"; } void DescribeNegationTo(::std::ostream* os) const { -- cgit v1.2.3