Generalize gmock-matchers_test to handle is_gtest_matcher-style matchers, too.

PiperOrigin-RevId: 444586594
Change-Id: I0de9b40b3773e3047a492f050266967ea935ae3e
This commit is contained in:
Abseil Team
2022-04-26 09:48:24 -07:00
committed by Copybara-Service
parent 0498660ea5
commit 238e4745c6
5 changed files with 144 additions and 50 deletions

View File

@@ -429,6 +429,8 @@ void AllOfMatches(int num, const Matcher<int>& m) {
EXPECT_TRUE(m.Matches(num + 1));
}
INSTANTIATE_GTEST_MATCHER_TEST_P(AllOfTest);
// Tests that AllOf(m1, ..., mn) matches any value that matches all of
// the given matchers.
TEST(AllOfTest, MatchesWhenAllMatch) {
@@ -552,7 +554,7 @@ TEST(AllOfTest, AllOfMatcherSafelyCastsMonomorphicMatchers) {
Matcher<int&> m5 = AllOf(greater_than_5, less_than_10, less_than_10);
}
TEST(AllOfTest, ExplainsResult) {
TEST_P(AllOfTestP, ExplainsResult) {
Matcher<int> m;
// Successful match. Both matchers need to explain. The second
@@ -616,6 +618,8 @@ static void AnyOfStringMatches(int num, const Matcher<std::string>& m) {
EXPECT_FALSE(m.Matches(std::to_string(num + 1)));
}
INSTANTIATE_GTEST_MATCHER_TEST_P(AnyOfTest);
// Tests that AnyOf(m1, ..., mn) matches any value that matches at
// least one of the given matchers.
TEST(AnyOfTest, MatchesWhenAnyMatches) {
@@ -766,7 +770,7 @@ TEST(AnyOfTest, AnyOfMatcherSafelyCastsMonomorphicMatchers) {
Matcher<int&> m5 = AnyOf(greater_than_5, less_than_10, less_than_10);
}
TEST(AnyOfTest, ExplainsResult) {
TEST_P(AnyOfTestP, ExplainsResult) {
Matcher<int> m;
// Failed match. Both matchers need to explain. The second