diff options
author | Gennadiy Civil <gennadiycivil@users.noreply.github.com> | 2018-04-04 16:14:41 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-04-04 16:14:41 -0400 |
commit | 2cf2a1f8ce9e25a2c0d053a51a3e67b3621f025b (patch) | |
tree | 553b3070e6a8e118a6a4864ac6ec40438ef6dd3f /googlemock/src/gmock-matchers.cc | |
parent | 891e436c6cb8817615c92494b8832ea51650c5a8 (diff) | |
parent | f7098a2a4dc2e3233251c4f8e8001ee773cd5a61 (diff) | |
download | googletest-2cf2a1f8ce9e25a2c0d053a51a3e67b3621f025b.tar.gz googletest-2cf2a1f8ce9e25a2c0d053a51a3e67b3621f025b.tar.bz2 googletest-2cf2a1f8ce9e25a2c0d053a51a3e67b3621f025b.zip |
Merge pull request #1545 from gennadiycivil/master
merging gmock matchers 1
Diffstat (limited to 'googlemock/src/gmock-matchers.cc')
-rw-r--r-- | googlemock/src/gmock-matchers.cc | 58 |
1 files changed, 52 insertions, 6 deletions
diff --git a/googlemock/src/gmock-matchers.cc b/googlemock/src/gmock-matchers.cc index a5ed686e..194d992d 100644 --- a/googlemock/src/gmock-matchers.cc +++ b/googlemock/src/gmock-matchers.cc @@ -105,6 +105,53 @@ Matcher<::string>::Matcher(const ::string& s) { *this = Eq(s); } Matcher<::string>::Matcher(const char* s) { *this = Eq(::string(s)); } #endif // GTEST_HAS_GLOBAL_STRING +#if GTEST_HAS_ABSL +// Constructs a matcher that matches a const absl::string_view& whose value is +// equal to s. +Matcher<const absl::string_view&>::Matcher(const std::string& s) { + *this = Eq(s); +} + +#if GTEST_HAS_GLOBAL_STRING +// Constructs a matcher that matches a const absl::string_view& whose value is +// equal to s. +Matcher<const absl::string_view&>::Matcher(const ::string& s) { *this = Eq(s); } +#endif // GTEST_HAS_GLOBAL_STRING + +// Constructs a matcher that matches a const absl::string_view& whose value is +// equal to s. +Matcher<const absl::string_view&>::Matcher(const char* s) { + *this = Eq(std::string(s)); +} + +// Constructs a matcher that matches a const absl::string_view& whose value is +// equal to s. +Matcher<const absl::string_view&>::Matcher(absl::string_view s) { + *this = Eq(std::string(s)); +} + +// Constructs a matcher that matches a absl::string_view whose value is equal to +// s. +Matcher<absl::string_view>::Matcher(const std::string& s) { *this = Eq(s); } + +#if GTEST_HAS_GLOBAL_STRING +// Constructs a matcher that matches a absl::string_view whose value is equal to +// s. +Matcher<absl::string_view>::Matcher(const ::string& s) { *this = Eq(s); } +#endif // GTEST_HAS_GLOBAL_STRING + +// Constructs a matcher that matches a absl::string_view whose value is equal to +// s. +Matcher<absl::string_view>::Matcher(const char* s) { + *this = Eq(std::string(s)); +} + +// Constructs a matcher that matches a absl::string_view whose value is equal to +// s. +Matcher<absl::string_view>::Matcher(absl::string_view s) { + *this = Eq(std::string(s)); +} +#endif // GTEST_HAS_ABSL namespace internal { @@ -113,12 +160,11 @@ namespace internal { // 'negation' is false; otherwise returns the description of the // negation of the matcher. 'param_values' contains a list of strings // that are the print-out of the matcher's parameters. -GTEST_API_ string FormatMatcherDescription(bool negation, - const char* matcher_name, - const Strings& param_values) { - string result = ConvertIdentifierNameToWords(matcher_name); - if (param_values.size() >= 1) - result += " " + JoinAsTuple(param_values); +GTEST_API_ std::string FormatMatcherDescription(bool negation, + const char* matcher_name, + const Strings& param_values) { + std::string result = ConvertIdentifierNameToWords(matcher_name); + if (param_values.size() >= 1) result += " " + JoinAsTuple(param_values); return negation ? "not (" + result + ")" : result; } |