When using MATCHER_P*() to define custom matchers, often we have parameters
that themselves are matchers, e.g.
MATCHER_P(HasAddress, matcher, ...) { ... }
Here the description of the HasProperty(matcher) matcher depends on the
description of the matcher. We should provide a function template:
template <typename Arg, class MatcherType>
string DescribeMatcher(const MatcherType& m, bool negation);
such that the user can write:
MATCHER_P(HasAddress, matcher,
"has an address that " +
DescribeMatcher<remove_reference<arg_type>::type *>(matcher, negation)) { ... }
where arg_type is the type of the value being matched, as inferred by the
compiler.
For example, HasAddress(IsNotNull()) will have a description:
has an address that is not NULL
Original issue reported on code.google.com by w...@google.com on 28 Sep 2010 at 5:24
Original issue reported on code.google.com by
w...@google.com
on 28 Sep 2010 at 5:24