summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAbseil Team <absl-team@google.com>2023-03-21 02:35:52 -0700
committerCopybara-Service <copybara-worker@google.com>2023-03-21 02:36:37 -0700
commite9faae170f8ab3086a76c299f19d659ba6079967 (patch)
tree1c9a6e4164ba3311c451204cd4d37a24d657a070
parentfa87209829d47f3fd7c6faf4e99d7d8799e3563d (diff)
downloadgoogletest-git-e9faae170f8ab3086a76c299f19d659ba6079967.tar.gz
Internal Code Change
PiperOrigin-RevId: 518213370 Change-Id: I88d0acc195dadf8d03cd15c8534c721141db14ea
-rw-r--r--googlemock/include/gmock/gmock-matchers.h10
1 files changed, 5 insertions, 5 deletions
diff --git a/googlemock/include/gmock/gmock-matchers.h b/googlemock/include/gmock/gmock-matchers.h
index a480576d..7c5d65cf 100644
--- a/googlemock/include/gmock/gmock-matchers.h
+++ b/googlemock/include/gmock/gmock-matchers.h
@@ -563,7 +563,7 @@ namespace internal {
// If the explanation is not empty, prints it to the ostream.
inline void PrintIfNotEmpty(const std::string& explanation,
::std::ostream* os) {
- if (explanation != "" && os != nullptr) {
+ if (!explanation.empty() && os != nullptr) {
*os << ", " << explanation;
}
}
@@ -2966,7 +2966,7 @@ class KeyMatcherImpl : public MatcherInterface<PairType> {
const bool match = inner_matcher_.MatchAndExplain(
pair_getters::First(key_value, Rank0()), &inner_listener);
const std::string explanation = inner_listener.str();
- if (explanation != "") {
+ if (!explanation.empty()) {
*listener << "whose first field is a value " << explanation;
}
return match;
@@ -3113,12 +3113,12 @@ class PairMatcherImpl : public MatcherInterface<PairType> {
const std::string& second_explanation,
MatchResultListener* listener) const {
*listener << "whose both fields match";
- if (first_explanation != "") {
+ if (!first_explanation.empty()) {
*listener << ", where the first field is a value " << first_explanation;
}
- if (second_explanation != "") {
+ if (!second_explanation.empty()) {
*listener << ", ";
- if (first_explanation != "") {
+ if (!first_explanation.empty()) {
*listener << "and ";
} else {
*listener << "where ";