From 1a3e2a265f35e604378156cd675b11ef0a184627 Mon Sep 17 00:00:00 2001 From: Taylor Cramer Date: Mon, 15 Nov 2021 13:47:36 -0800 Subject: [PATCH] Clarify "Times() after X" error message The previous error message could be misinterpreted to mean that `Times` could not be used in combination with `WillRepeatedly`, when in fact the call to `Times` just needs to happen *first*. PiperOrigin-RevId: 410070405 Change-Id: I747d34a4334cf2e56d589dcad3a08a8f322d77c8 --- googlemock/src/gmock-spec-builders.cc | 8 ++++---- googlemock/test/gmock-spec-builders_test.cc | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/googlemock/src/gmock-spec-builders.cc b/googlemock/src/gmock-spec-builders.cc index df023e49..8f8d7f9b 100644 --- a/googlemock/src/gmock-spec-builders.cc +++ b/googlemock/src/gmock-spec-builders.cc @@ -264,10 +264,10 @@ void ExpectationBase::UntypedTimes(const Cardinality& a_cardinality) { ".Times() cannot appear " "more than once in an EXPECT_CALL()."); } else { - ExpectSpecProperty(last_clause_ < kTimes, - ".Times() cannot appear after " - ".InSequence(), .WillOnce(), .WillRepeatedly(), " - "or .RetiresOnSaturation()."); + ExpectSpecProperty( + last_clause_ < kTimes, + ".Times() may only appear *before* .InSequence(), .WillOnce(), " + ".WillRepeatedly(), or .RetiresonSaturation(), not after."); } last_clause_ = kTimes; diff --git a/googlemock/test/gmock-spec-builders_test.cc b/googlemock/test/gmock-spec-builders_test.cc index b13e1c14..7f29b612 100644 --- a/googlemock/test/gmock-spec-builders_test.cc +++ b/googlemock/test/gmock-spec-builders_test.cc @@ -390,7 +390,7 @@ TEST(ExpectCallSyntaxTest, TimesMustBeBeforeInSequence) { EXPECT_CALL(a, DoA(1)) .InSequence(s) .Times(1); - }, ".Times() cannot appear after "); + }, ".Times() may only appear *before* "); a.DoA(1); }