Include the param names in the generated description of the MATCHER_P matchers.
PiperOrigin-RevId: 418497526 Change-Id: Ie53c3c0810c10a32cbcb941e3ca1ee8fb1ddd9f9
This commit is contained in:
committed by
Copybara-Service
parent
d81ae2f0bf
commit
6b74da4757
@@ -3864,9 +3864,9 @@ BoundSecondMatcher<Tuple2Matcher, Second> MatcherBindSecond(
|
||||
// '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_ std::string FormatMatcherDescription(bool negation,
|
||||
const char* matcher_name,
|
||||
const Strings& param_values);
|
||||
GTEST_API_ std::string FormatMatcherDescription(
|
||||
bool negation, const char* matcher_name,
|
||||
const std::vector<const char*>& param_names, const Strings& param_values);
|
||||
|
||||
// Implements a matcher that checks the value of a optional<> type variable.
|
||||
template <typename ValueMatcher>
|
||||
@@ -5449,7 +5449,7 @@ PolymorphicMatcher<internal::ExceptionMatcherImpl<Err>> ThrowsMessage(
|
||||
return gmock_description; \
|
||||
} \
|
||||
return ::testing::internal::FormatMatcherDescription(negation, #name, \
|
||||
{}); \
|
||||
{}, {}); \
|
||||
} \
|
||||
}; \
|
||||
}; \
|
||||
@@ -5461,33 +5461,41 @@ PolymorphicMatcher<internal::ExceptionMatcherImpl<Err>> ThrowsMessage(
|
||||
const
|
||||
|
||||
#define MATCHER_P(name, p0, description) \
|
||||
GMOCK_INTERNAL_MATCHER(name, name##MatcherP, description, (p0))
|
||||
#define MATCHER_P2(name, p0, p1, description) \
|
||||
GMOCK_INTERNAL_MATCHER(name, name##MatcherP2, description, (p0, p1))
|
||||
#define MATCHER_P3(name, p0, p1, p2, description) \
|
||||
GMOCK_INTERNAL_MATCHER(name, name##MatcherP3, description, (p0, p1, p2))
|
||||
#define MATCHER_P4(name, p0, p1, p2, p3, description) \
|
||||
GMOCK_INTERNAL_MATCHER(name, name##MatcherP4, description, (p0, p1, p2, p3))
|
||||
GMOCK_INTERNAL_MATCHER(name, name##MatcherP, description, (#p0), (p0))
|
||||
#define MATCHER_P2(name, p0, p1, description) \
|
||||
GMOCK_INTERNAL_MATCHER(name, name##MatcherP2, description, (#p0, #p1), \
|
||||
(p0, p1))
|
||||
#define MATCHER_P3(name, p0, p1, p2, description) \
|
||||
GMOCK_INTERNAL_MATCHER(name, name##MatcherP3, description, (#p0, #p1, #p2), \
|
||||
(p0, p1, p2))
|
||||
#define MATCHER_P4(name, p0, p1, p2, p3, description) \
|
||||
GMOCK_INTERNAL_MATCHER(name, name##MatcherP4, description, \
|
||||
(#p0, #p1, #p2, #p3), (p0, p1, p2, p3))
|
||||
#define MATCHER_P5(name, p0, p1, p2, p3, p4, description) \
|
||||
GMOCK_INTERNAL_MATCHER(name, name##MatcherP5, description, \
|
||||
(p0, p1, p2, p3, p4))
|
||||
(#p0, #p1, #p2, #p3, #p4), (p0, p1, p2, p3, p4))
|
||||
#define MATCHER_P6(name, p0, p1, p2, p3, p4, p5, description) \
|
||||
GMOCK_INTERNAL_MATCHER(name, name##MatcherP6, description, \
|
||||
(#p0, #p1, #p2, #p3, #p4, #p5), \
|
||||
(p0, p1, p2, p3, p4, p5))
|
||||
#define MATCHER_P7(name, p0, p1, p2, p3, p4, p5, p6, description) \
|
||||
GMOCK_INTERNAL_MATCHER(name, name##MatcherP7, description, \
|
||||
(#p0, #p1, #p2, #p3, #p4, #p5, #p6), \
|
||||
(p0, p1, p2, p3, p4, p5, p6))
|
||||
#define MATCHER_P8(name, p0, p1, p2, p3, p4, p5, p6, p7, description) \
|
||||
GMOCK_INTERNAL_MATCHER(name, name##MatcherP8, description, \
|
||||
(#p0, #p1, #p2, #p3, #p4, #p5, #p6, #p7), \
|
||||
(p0, p1, p2, p3, p4, p5, p6, p7))
|
||||
#define MATCHER_P9(name, p0, p1, p2, p3, p4, p5, p6, p7, p8, description) \
|
||||
GMOCK_INTERNAL_MATCHER(name, name##MatcherP9, description, \
|
||||
(#p0, #p1, #p2, #p3, #p4, #p5, #p6, #p7, #p8), \
|
||||
(p0, p1, p2, p3, p4, p5, p6, p7, p8))
|
||||
#define MATCHER_P10(name, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, description) \
|
||||
GMOCK_INTERNAL_MATCHER(name, name##MatcherP10, description, \
|
||||
(#p0, #p1, #p2, #p3, #p4, #p5, #p6, #p7, #p8, #p9), \
|
||||
(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9))
|
||||
|
||||
#define GMOCK_INTERNAL_MATCHER(name, full_name, description, args) \
|
||||
#define GMOCK_INTERNAL_MATCHER(name, full_name, description, arg_names, args) \
|
||||
template <GMOCK_INTERNAL_MATCHER_TEMPLATE_PARAMS(args)> \
|
||||
class full_name : public ::testing::internal::MatcherBaseImpl< \
|
||||
full_name<GMOCK_INTERNAL_MATCHER_TYPE_PARAMS(args)>> { \
|
||||
@@ -5516,7 +5524,7 @@ PolymorphicMatcher<internal::ExceptionMatcherImpl<Err>> ThrowsMessage(
|
||||
return gmock_description; \
|
||||
} \
|
||||
return ::testing::internal::FormatMatcherDescription( \
|
||||
negation, #name, \
|
||||
negation, #name, {GMOCK_PP_REMOVE_PARENS(arg_names)}, \
|
||||
::testing::internal::UniversalTersePrintTupleFieldsToStrings( \
|
||||
::std::tuple<GMOCK_INTERNAL_MATCHER_TYPE_PARAMS(args)>( \
|
||||
GMOCK_INTERNAL_MATCHER_MEMBERS_USAGE(args)))); \
|
||||
|
||||
@@ -38,9 +38,12 @@
|
||||
#define GOOGLEMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_INTERNAL_UTILS_H_
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include <ostream> // NOLINT
|
||||
#include <string>
|
||||
#include <type_traits>
|
||||
#include <vector>
|
||||
|
||||
#include "gmock/internal/gmock-port.h"
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
@@ -61,7 +64,8 @@ namespace internal {
|
||||
|
||||
// Joins a vector of strings as if they are fields of a tuple; returns
|
||||
// the joined string.
|
||||
GTEST_API_ std::string JoinAsTuple(const Strings& fields);
|
||||
GTEST_API_ std::string JoinAsKeyValueTuple(
|
||||
const std::vector<const char*>& names, const Strings& values);
|
||||
|
||||
// Converts an identifier name to a space-separated list of lower-case
|
||||
// words. Each maximum substring of the form [A-Za-z][a-z]*|\d+ is
|
||||
|
||||
Reference in New Issue
Block a user