Use matcher's description in AllOf if matcher has no explanation.

PiperOrigin-RevId: 652798234
Change-Id: I8e92248a2d9faf2a5719fe220145ea563acc14ff
This commit is contained in:
Abseil Team
2024-07-16 05:22:04 -07:00
committed by Copybara-Service
parent 417158b8bc
commit d49a665484
3 changed files with 23 additions and 39 deletions

View File

@@ -2334,11 +2334,9 @@ TEST(ExplainMatchResultTest, AllOf_True_True) {
EXPECT_EQ("which is 0 modulo 2, and which is 0 modulo 3", Explain(m, 6));
}
// Tests that when AllOf() succeeds, but matchers have no explanation,
// the matcher description is used.
TEST(ExplainMatchResultTest, AllOf_True_True_2) {
const Matcher<int> m = AllOf(Ge(2), Le(3));
EXPECT_EQ("is >= 2, and is <= 3", Explain(m, 2));
EXPECT_EQ("", Explain(m, 2));
}
INSTANTIATE_GTEST_MATCHER_TEST_P(ExplainmatcherResultTest);