From e17e37a1151a47d6e8089f2e9a78921ac022a511 Mon Sep 17 00:00:00 2001 From: Abseil Team Date: Wed, 15 Oct 2025 21:01:25 -0700 Subject: [PATCH] Automated Code Change PiperOrigin-RevId: 820039898 Change-Id: I910d8ec41198794e7344a2d79566a19243532251 --- googlemock/test/gmock-actions_test.cc | 4 ++-- googlemock/test/gmock-matchers-arithmetic_test.cc | 6 +++--- googlemock/test/gmock-matchers-containers_test.cc | 6 +++--- googlemock/test/gmock-matchers-misc_test.cc | 8 ++++---- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/googlemock/test/gmock-actions_test.cc b/googlemock/test/gmock-actions_test.cc index 975170539..6200611c1 100644 --- a/googlemock/test/gmock-actions_test.cc +++ b/googlemock/test/gmock-actions_test.cc @@ -1822,7 +1822,7 @@ std::vector> VectorUniquePtrSource() { TEST(MockMethodTest, CanReturnMoveOnlyValue_Return) { MockClass mock; - std::unique_ptr i(new int(19)); + std::unique_ptr i = std::make_unique(19); EXPECT_CALL(mock, MakeUnique()).WillOnce(Return(ByMove(std::move(i)))); EXPECT_CALL(mock, MakeVectorUnique()) .WillOnce(Return(ByMove(VectorUniquePtrSource()))); @@ -1845,7 +1845,7 @@ TEST(MockMethodTest, CanReturnMoveOnlyValue_Return) { TEST(MockMethodTest, CanReturnMoveOnlyValue_DoAllReturn) { testing::MockFunction mock_function; MockClass mock; - std::unique_ptr i(new int(19)); + std::unique_ptr i = std::make_unique(19); EXPECT_CALL(mock_function, Call()); EXPECT_CALL(mock, MakeUnique()) .WillOnce(DoAll(InvokeWithoutArgs(&mock_function, diff --git a/googlemock/test/gmock-matchers-arithmetic_test.cc b/googlemock/test/gmock-matchers-arithmetic_test.cc index b6c35119e..c4c91b8b3 100644 --- a/googlemock/test/gmock-matchers-arithmetic_test.cc +++ b/googlemock/test/gmock-matchers-arithmetic_test.cc @@ -1625,7 +1625,7 @@ TEST_F(DoubleNearTest, NanSensitiveDoubleNearCanMatchNaN) { } TEST(NotTest, WorksOnMoveOnlyType) { - std::unique_ptr p(new int(3)); + std::unique_ptr p = std::make_unique(3); EXPECT_THAT(p, Pointee(Eq(3))); EXPECT_THAT(p, Not(Pointee(Eq(2)))); } @@ -1681,13 +1681,13 @@ TEST(AnyOfTest, DoesNotCallAnyOfUnqualified) { } // namespace adl_test TEST(AllOfTest, WorksOnMoveOnlyType) { - std::unique_ptr p(new int(3)); + std::unique_ptr p = std::make_unique(3); EXPECT_THAT(p, AllOf(Pointee(Eq(3)), Pointee(Gt(0)), Pointee(Lt(5)))); EXPECT_THAT(p, Not(AllOf(Pointee(Eq(3)), Pointee(Gt(0)), Pointee(Lt(3))))); } TEST(AnyOfTest, WorksOnMoveOnlyType) { - std::unique_ptr p(new int(3)); + std::unique_ptr p = std::make_unique(3); EXPECT_THAT(p, AnyOf(Pointee(Eq(5)), Pointee(Lt(0)), Pointee(Lt(5)))); EXPECT_THAT(p, Not(AnyOf(Pointee(Eq(5)), Pointee(Lt(0)), Pointee(Gt(5))))); } diff --git a/googlemock/test/gmock-matchers-containers_test.cc b/googlemock/test/gmock-matchers-containers_test.cc index e9f1a02d8..c3b3ef03f 100644 --- a/googlemock/test/gmock-matchers-containers_test.cc +++ b/googlemock/test/gmock-matchers-containers_test.cc @@ -217,7 +217,7 @@ TEST(PointeeTest, ReferenceToNonConstRawPointer) { TEST(PointeeTest, SmartPointer) { const Matcher> m = Pointee(Ge(0)); - std::unique_ptr n(new int(1)); + std::unique_ptr n = std::make_unique(1); EXPECT_TRUE(m.Matches(n)); } @@ -254,7 +254,7 @@ TEST(PointerTest, RawPointerToConst) { } TEST(PointerTest, SmartPointer) { - std::unique_ptr n(new int(10)); + std::unique_ptr n = std::make_unique(10); int* raw_n = n.get(); const Matcher> m = Pointer(Eq(raw_n)); @@ -2796,7 +2796,7 @@ TEST(UnorderedPointwiseTest, WorksWithMoveOnly) { } TEST(PointeeTest, WorksOnMoveOnlyType) { - std::unique_ptr p(new int(3)); + std::unique_ptr p = std::make_unique(3); EXPECT_THAT(p, Pointee(Eq(3))); EXPECT_THAT(p, Not(Pointee(Eq(2)))); } diff --git a/googlemock/test/gmock-matchers-misc_test.cc b/googlemock/test/gmock-matchers-misc_test.cc index de8b76c69..0161169f2 100644 --- a/googlemock/test/gmock-matchers-misc_test.cc +++ b/googlemock/test/gmock-matchers-misc_test.cc @@ -79,7 +79,7 @@ TEST(AddressTest, Const) { } TEST(AddressTest, MatcherDoesntCopy) { - std::unique_ptr n(new int(1)); + std::unique_ptr n = std::make_unique(1); const Matcher> m = Address(Eq(&n)); EXPECT_TRUE(m.Matches(n)); @@ -202,7 +202,7 @@ TEST(IsTrueTest, IsTrueIsFalse) { EXPECT_THAT(nullptr, Not(IsTrue())); EXPECT_THAT(nullptr, IsFalse()); std::unique_ptr null_unique; - std::unique_ptr nonnull_unique(new int(0)); + std::unique_ptr nonnull_unique = std::make_unique(0); EXPECT_THAT(null_unique, Not(IsTrue())); EXPECT_THAT(null_unique, IsFalse()); EXPECT_THAT(nonnull_unique, IsTrue()); @@ -1665,7 +1665,7 @@ MATCHER(IsNotNull, "") { return arg != nullptr; } // Verifies that a matcher defined using MATCHER() can work on // move-only types. TEST(MatcherMacroTest, WorksOnMoveOnlyType) { - std::unique_ptr p(new int(3)); + std::unique_ptr p = std::make_unique(3); EXPECT_THAT(p, IsNotNull()); EXPECT_THAT(std::unique_ptr(), Not(IsNotNull())); } @@ -1675,7 +1675,7 @@ MATCHER_P(UniquePointee, pointee, "") { return *arg == pointee; } // Verifies that a matcher defined using MATCHER_P*() can work on // move-only types. TEST(MatcherPMacroTest, WorksOnMoveOnlyType) { - std::unique_ptr p(new int(3)); + std::unique_ptr p = std::make_unique(3); EXPECT_THAT(p, UniquePointee(3)); EXPECT_THAT(p, Not(UniquePointee(2))); }