mirror of https://github.com/google/googletest.git
Fix UB in gmock tests: add missing EXPECT_CALL before mock invocations
gmock-actions_test.cc: Add EXPECT_CALL before DefaultValue check that previously invoked mock without expectation. gmock-matchers-arithmetic_test.cc: Add bare EXPECT_CALLs in AllArgsTest before mock methods that were called without expectations.
This commit is contained in:
parent
8240fa7d62
commit
f7a79d379a
|
|
@ -1859,6 +1859,7 @@ TEST(MockMethodTest, CanReturnMoveOnlyValue_Invoke) {
|
|||
// Check default value
|
||||
DefaultValue<std::unique_ptr<int>>::SetFactory(
|
||||
[] { return std::make_unique<int>(42); });
|
||||
EXPECT_CALL(mock, MakeUnique()).WillOnce(DoDefault());
|
||||
EXPECT_EQ(42, *mock.MakeUnique());
|
||||
|
||||
EXPECT_CALL(mock, MakeUnique()).WillRepeatedly(UniquePtrSource);
|
||||
|
|
|
|||
|
|
@ -1182,6 +1182,10 @@ TEST(AllArgsTest, WorksWithoutMatchers) {
|
|||
ON_CALL(helper, OneArg).WillByDefault(Return(20));
|
||||
ON_CALL(helper, TwoArgs).WillByDefault(Return(30));
|
||||
|
||||
EXPECT_CALL(helper, NoArgs);
|
||||
EXPECT_CALL(helper, OneArg);
|
||||
EXPECT_CALL(helper, TwoArgs);
|
||||
|
||||
EXPECT_EQ(10, helper.NoArgs());
|
||||
EXPECT_EQ(20, helper.OneArg(1));
|
||||
EXPECT_EQ(30, helper.TwoArgs('\1', 2));
|
||||
|
|
|
|||
Loading…
Reference in New Issue