in ext/gtest-1.8.0/googlemock/include/gmock/gmock-spec-builders.h [1106:1148]
void ExplainMatchResultTo(
const ArgumentTuple& args,
::std::ostream* os) const
GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) {
g_gmock_mutex.AssertHeld();
if (is_retired()) {
*os << " Expected: the expectation is active\n"
<< " Actual: it is retired\n";
} else if (!Matches(args)) {
if (!TupleMatches(matchers_, args)) {
ExplainMatchFailureTupleTo(matchers_, args, os);
}
StringMatchResultListener listener;
if (!extra_matcher_.MatchAndExplain(args, &listener)) {
*os << " Expected args: ";
extra_matcher_.DescribeTo(os);
*os << "\n Actual: don't match";
internal::PrintIfNotEmpty(listener.str(), os);
*os << "\n";
}
} else if (!AllPrerequisitesAreSatisfied()) {
*os << " Expected: all pre-requisites are satisfied\n"
<< " Actual: the following immediate pre-requisites "
<< "are not satisfied:\n";
ExpectationSet unsatisfied_prereqs;
FindUnsatisfiedPrerequisites(&unsatisfied_prereqs);
int i = 0;
for (ExpectationSet::const_iterator it = unsatisfied_prereqs.begin();
it != unsatisfied_prereqs.end(); ++it) {
it->expectation_base()->DescribeLocationTo(os);
*os << "pre-requisite #" << i++ << "\n";
}
*os << " (end of pre-requisites)\n";
} else {
// This line is here just for completeness' sake. It will never
// be executed as currently the ExplainMatchResultTo() function
// is called only when the mock function call does NOT match the
// expectation.
*os << "The call matches the expectation.\n";
}
}