From 1f122a06e6aad4d234123d2d8c1e352029ce0742 Mon Sep 17 00:00:00 2001 From: "zhanyong.wan" Date: Mon, 25 Mar 2013 16:27:03 +0000 Subject: Adds special support for matching StringPiece. Pulls in gtest r646. --- src/gmock-matchers.cc | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) (limited to 'src') diff --git a/src/gmock-matchers.cc b/src/gmock-matchers.cc index 63f3859b..5f746b95 100644 --- a/src/gmock-matchers.cc +++ b/src/gmock-matchers.cc @@ -63,6 +63,41 @@ Matcher::Matcher(const char* s) { *this = Eq(internal::string(s)); } +#if GTEST_HAS_STRING_PIECE_ +// Constructs a matcher that matches a const StringPiece& whose value is +// equal to s. +Matcher::Matcher(const internal::string& s) { + *this = Eq(s); +} + +// Constructs a matcher that matches a const StringPiece& whose value is +// equal to s. +Matcher::Matcher(const char* s) { + *this = Eq(internal::string(s)); +} + +// Constructs a matcher that matches a const StringPiece& whose value is +// equal to s. +Matcher::Matcher(StringPiece s) { + *this = Eq(s.ToString()); +} + +// Constructs a matcher that matches a StringPiece whose value is equal to s. +Matcher::Matcher(const internal::string& s) { + *this = Eq(s); +} + +// Constructs a matcher that matches a StringPiece whose value is equal to s. +Matcher::Matcher(const char* s) { + *this = Eq(internal::string(s)); +} + +// Constructs a matcher that matches a StringPiece whose value is equal to s. +Matcher::Matcher(StringPiece s) { + *this = Eq(s.ToString()); +} +#endif // GTEST_HAS_STRING_PIECE_ + namespace internal { // Joins a vector of strings as if they are fields of a tuple; returns -- cgit v1.2.3