summaryrefslogtreecommitdiffstats
path: root/googlemock/src
diff options
context:
space:
mode:
authorDenis Hananein <i@zloylos.me>2022-10-20 21:13:06 (GMT)
committerDenis Hananein <i@zloylos.me>2022-10-20 21:13:06 (GMT)
commitf3eb2b7e38e132402f8f67e86feb97813714c3d7 (patch)
tree7a605fefdfcb5fb577c55b58ac82ed446089efc8 /googlemock/src
parente07617d6c692a96e126f11f85c3e38e46b10b4d0 (diff)
downloadgoogletest-f3eb2b7e38e132402f8f67e86feb97813714c3d7.zip
googletest-f3eb2b7e38e132402f8f67e86feb97813714c3d7.tar.gz
googletest-f3eb2b7e38e132402f8f67e86feb97813714c3d7.tar.bz2
Allow naming expectations #3970
Signed-off-by: Denis Hananein <i@zloylos.me>
Diffstat (limited to 'googlemock/src')
-rw-r--r--googlemock/src/gmock-spec-builders.cc10
1 files changed, 8 insertions, 2 deletions
diff --git a/googlemock/src/gmock-spec-builders.cc b/googlemock/src/gmock-spec-builders.cc
index b333e53..e5f4609 100644
--- a/googlemock/src/gmock-spec-builders.cc
+++ b/googlemock/src/gmock-spec-builders.cc
@@ -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.