summaryrefslogtreecommitdiffstats
path: root/googlemock/include/gmock/gmock-matchers.h
diff options
context:
space:
mode:
authorAbseil Team <absl-team@google.com>2018-09-13 15:27:56 (GMT)
committerGennadiy Civil <misterg@google.com>2018-09-14 15:13:48 (GMT)
commitffc9baeb4cb81a7db250249920a9bd3d5ace760a (patch)
treeb8107cc41ca5928f4ecb525cbf933089fdb725b1 /googlemock/include/gmock/gmock-matchers.h
parentcfe0ae867857dad6d14ff72a2f02808086021f35 (diff)
downloadgoogletest-ffc9baeb4cb81a7db250249920a9bd3d5ace760a.zip
googletest-ffc9baeb4cb81a7db250249920a9bd3d5ace760a.tar.gz
googletest-ffc9baeb4cb81a7db250249920a9bd3d5ace760a.tar.bz2
Googletest exportrefs/pull/1837/head
Treat default-constructed string_view same as constructed from "". In the context of string comparison (e.g. HasSubstr, StartsWith, EndsWith, etc.), a default-constructed string_view (nullptr) should be semantically same as a empty string "". PiperOrigin-RevId: 212816839
Diffstat (limited to 'googlemock/include/gmock/gmock-matchers.h')
-rw-r--r--googlemock/include/gmock/gmock-matchers.h14
1 files changed, 1 insertions, 13 deletions
diff --git a/googlemock/include/gmock/gmock-matchers.h b/googlemock/include/gmock/gmock-matchers.h
index a7bcfc8..fa26bf9 100644
--- a/googlemock/include/gmock/gmock-matchers.h
+++ b/googlemock/include/gmock/gmock-matchers.h
@@ -1307,9 +1307,6 @@ class StrEqualityMatcher {
#if GTEST_HAS_ABSL
bool MatchAndExplain(const absl::string_view& s,
MatchResultListener* listener) const {
- if (s.data() == NULL) {
- return !expect_eq_;
- }
// This should fail to compile if absl::string_view is used with wide
// strings.
const StringType& str = string(s);
@@ -1380,9 +1377,6 @@ class HasSubstrMatcher {
#if GTEST_HAS_ABSL
bool MatchAndExplain(const absl::string_view& s,
MatchResultListener* listener) const {
- if (s.data() == NULL) {
- return false;
- }
// This should fail to compile if absl::string_view is used with wide
// strings.
const StringType& str = string(s);
@@ -1440,9 +1434,6 @@ class StartsWithMatcher {
#if GTEST_HAS_ABSL
bool MatchAndExplain(const absl::string_view& s,
MatchResultListener* listener) const {
- if (s.data() == NULL) {
- return false;
- }
// This should fail to compile if absl::string_view is used with wide
// strings.
const StringType& str = string(s);
@@ -1499,9 +1490,6 @@ class EndsWithMatcher {
#if GTEST_HAS_ABSL
bool MatchAndExplain(const absl::string_view& s,
MatchResultListener* listener) const {
- if (s.data() == NULL) {
- return false;
- }
// This should fail to compile if absl::string_view is used with wide
// strings.
const StringType& str = string(s);
@@ -1558,7 +1546,7 @@ class MatchesRegexMatcher {
#if GTEST_HAS_ABSL
bool MatchAndExplain(const absl::string_view& s,
MatchResultListener* listener) const {
- return s.data() && MatchAndExplain(string(s), listener);
+ return MatchAndExplain(string(s), listener);
}
#endif // GTEST_HAS_ABSL