diff options
author | Copybara-Service <copybara-worker@google.com> | 2022-10-25 15:39:19 (GMT) |
---|---|---|
committer | Copybara-Service <copybara-worker@google.com> | 2022-10-25 15:39:19 (GMT) |
commit | 3026483ae575e2de942db5e760cf95e973308dd5 (patch) | |
tree | db98cb58df5aabc6ed8295fca7069850474e504e /googlemock/test/gmock-spec-builders_test.cc | |
parent | 90171d106135fc03db211fcfe928527f3cb74a5e (diff) | |
parent | 09e1c64f86634dd3a38bff59f3c24c5b8ad6675a (diff) | |
download | googletest-3026483ae575e2de942db5e760cf95e973308dd5.zip googletest-3026483ae575e2de942db5e760cf95e973308dd5.tar.gz googletest-3026483ae575e2de942db5e760cf95e973308dd5.tar.bz2 |
Merge pull request #4041 from zloylos:allow-naming-expectations
PiperOrigin-RevId: 483683590
Change-Id: Id22de3a22018324e5c1e21e262ac5e027a83bf3e
Diffstat (limited to 'googlemock/test/gmock-spec-builders_test.cc')
-rw-r--r-- | googlemock/test/gmock-spec-builders_test.cc | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/googlemock/test/gmock-spec-builders_test.cc b/googlemock/test/gmock-spec-builders_test.cc index daa109d..165944e 100644 --- a/googlemock/test/gmock-spec-builders_test.cc +++ b/googlemock/test/gmock-spec-builders_test.cc @@ -739,11 +739,12 @@ TEST(ExpectCallTest, CatchesTooFewCalls) { EXPECT_NONFATAL_FAILURE( { // NOLINT MockB b; - EXPECT_CALL(b, DoB(5)).Times(AtLeast(2)); + EXPECT_CALL(b, DoB(5)).Description("DoB Method").Times(AtLeast(2)); b.DoB(5); }, - "Actual function call count doesn't match EXPECT_CALL(b, DoB(5))...\n" + "Actual function \"DoB Method\" call count " + "doesn't match EXPECT_CALL(b, DoB(5))...\n" " Expected: to be called at least twice\n" " Actual: called once - unsatisfied and active"); } @@ -1148,10 +1149,11 @@ TEST(ExcessiveCallTest, DoesDefaultAction) { // When there is no ON_CALL(), the default value for the return type // should be returned. MockB b; - EXPECT_CALL(b, DoB(0)).Times(0); + EXPECT_CALL(b, DoB(0)).Description("DoB Method").Times(0); int n = -1; - EXPECT_NONFATAL_FAILURE(n = b.DoB(0), - "Mock function called more times than expected"); + EXPECT_NONFATAL_FAILURE( + n = b.DoB(0), + "Mock function \"DoB Method\" called more times than expected"); EXPECT_EQ(0, n); } @@ -1159,10 +1161,11 @@ TEST(ExcessiveCallTest, DoesDefaultAction) { // the failure message contains the argument values. TEST(ExcessiveCallTest, GeneratesFailureForVoidFunction) { MockA a; - EXPECT_CALL(a, DoA(_)).Times(0); + EXPECT_CALL(a, DoA(_)).Description("DoA Method").Times(0); EXPECT_NONFATAL_FAILURE( a.DoA(9), - "Mock function called more times than expected - returning directly.\n" + "Mock function \"DoA Method\" called more times than expected - " + "returning directly.\n" " Function call: DoA(9)\n" " Expected: to be never called\n" " Actual: called once - over-saturated and active"); |