Allow naming expectations #3970

Signed-off-by: Denis Hananein <i@zloylos.me>
This commit is contained in:
Denis Hananein
2022-10-20 23:13:06 +02:00
parent e07617d6c6
commit f3eb2b7e38
2 changed files with 29 additions and 4 deletions
+8 -2
View File
@@ -409,8 +409,14 @@ bool UntypedFunctionMockerBase::VerifyAndClearExpectationsLocked()
} else if (!untyped_expectation->IsSatisfied()) {
expectations_met = false;
::std::stringstream ss;
ss << "Actual function call count doesn't match "
<< untyped_expectation->source_text() << "...\n";
const ::std::string& expectation_name = untyped_expectation->GetName();
ss << "Actual function";
if (!expectation_name.empty()) {
ss << " with name \"" << expectation_name << "\"";
}
ss << " call count doesn't match " << untyped_expectation->source_text()
<< "...\n";
// No need to show the source file location of the expectation
// in the description, as the Expect() call that follows already
// takes care of it.