Skip to content

Commit e17e37a

Browse files
Abseil Teamcopybara-github
authored andcommitted
Automated Code Change
PiperOrigin-RevId: 820039898 Change-Id: I910d8ec41198794e7344a2d79566a19243532251
1 parent 8dbd60f commit e17e37a

File tree

4 files changed

+12
-12
lines changed

4 files changed

+12
-12
lines changed

googlemock/test/gmock-actions_test.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1822,7 +1822,7 @@ std::vector<std::unique_ptr<int>> VectorUniquePtrSource() {
18221822

18231823
TEST(MockMethodTest, CanReturnMoveOnlyValue_Return) {
18241824
MockClass mock;
1825-
std::unique_ptr<int> i(new int(19));
1825+
std::unique_ptr<int> i = std::make_unique<int>(19);
18261826
EXPECT_CALL(mock, MakeUnique()).WillOnce(Return(ByMove(std::move(i))));
18271827
EXPECT_CALL(mock, MakeVectorUnique())
18281828
.WillOnce(Return(ByMove(VectorUniquePtrSource())));
@@ -1845,7 +1845,7 @@ TEST(MockMethodTest, CanReturnMoveOnlyValue_Return) {
18451845
TEST(MockMethodTest, CanReturnMoveOnlyValue_DoAllReturn) {
18461846
testing::MockFunction<void()> mock_function;
18471847
MockClass mock;
1848-
std::unique_ptr<int> i(new int(19));
1848+
std::unique_ptr<int> i = std::make_unique<int>(19);
18491849
EXPECT_CALL(mock_function, Call());
18501850
EXPECT_CALL(mock, MakeUnique())
18511851
.WillOnce(DoAll(InvokeWithoutArgs(&mock_function,

googlemock/test/gmock-matchers-arithmetic_test.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1625,7 +1625,7 @@ TEST_F(DoubleNearTest, NanSensitiveDoubleNearCanMatchNaN) {
16251625
}
16261626

16271627
TEST(NotTest, WorksOnMoveOnlyType) {
1628-
std::unique_ptr<int> p(new int(3));
1628+
std::unique_ptr<int> p = std::make_unique<int>(3);
16291629
EXPECT_THAT(p, Pointee(Eq(3)));
16301630
EXPECT_THAT(p, Not(Pointee(Eq(2))));
16311631
}
@@ -1681,13 +1681,13 @@ TEST(AnyOfTest, DoesNotCallAnyOfUnqualified) {
16811681
} // namespace adl_test
16821682

16831683
TEST(AllOfTest, WorksOnMoveOnlyType) {
1684-
std::unique_ptr<int> p(new int(3));
1684+
std::unique_ptr<int> p = std::make_unique<int>(3);
16851685
EXPECT_THAT(p, AllOf(Pointee(Eq(3)), Pointee(Gt(0)), Pointee(Lt(5))));
16861686
EXPECT_THAT(p, Not(AllOf(Pointee(Eq(3)), Pointee(Gt(0)), Pointee(Lt(3)))));
16871687
}
16881688

16891689
TEST(AnyOfTest, WorksOnMoveOnlyType) {
1690-
std::unique_ptr<int> p(new int(3));
1690+
std::unique_ptr<int> p = std::make_unique<int>(3);
16911691
EXPECT_THAT(p, AnyOf(Pointee(Eq(5)), Pointee(Lt(0)), Pointee(Lt(5))));
16921692
EXPECT_THAT(p, Not(AnyOf(Pointee(Eq(5)), Pointee(Lt(0)), Pointee(Gt(5)))));
16931693
}

googlemock/test/gmock-matchers-containers_test.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ TEST(PointeeTest, ReferenceToNonConstRawPointer) {
217217
TEST(PointeeTest, SmartPointer) {
218218
const Matcher<std::unique_ptr<int>> m = Pointee(Ge(0));
219219

220-
std::unique_ptr<int> n(new int(1));
220+
std::unique_ptr<int> n = std::make_unique<int>(1);
221221
EXPECT_TRUE(m.Matches(n));
222222
}
223223

@@ -254,7 +254,7 @@ TEST(PointerTest, RawPointerToConst) {
254254
}
255255

256256
TEST(PointerTest, SmartPointer) {
257-
std::unique_ptr<int> n(new int(10));
257+
std::unique_ptr<int> n = std::make_unique<int>(10);
258258
int* raw_n = n.get();
259259
const Matcher<std::unique_ptr<int>> m = Pointer(Eq(raw_n));
260260

@@ -2796,7 +2796,7 @@ TEST(UnorderedPointwiseTest, WorksWithMoveOnly) {
27962796
}
27972797

27982798
TEST(PointeeTest, WorksOnMoveOnlyType) {
2799-
std::unique_ptr<int> p(new int(3));
2799+
std::unique_ptr<int> p = std::make_unique<int>(3);
28002800
EXPECT_THAT(p, Pointee(Eq(3)));
28012801
EXPECT_THAT(p, Not(Pointee(Eq(2))));
28022802
}

googlemock/test/gmock-matchers-misc_test.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ TEST(AddressTest, Const) {
7979
}
8080

8181
TEST(AddressTest, MatcherDoesntCopy) {
82-
std::unique_ptr<int> n(new int(1));
82+
std::unique_ptr<int> n = std::make_unique<int>(1);
8383
const Matcher<std::unique_ptr<int>> m = Address(Eq(&n));
8484

8585
EXPECT_TRUE(m.Matches(n));
@@ -202,7 +202,7 @@ TEST(IsTrueTest, IsTrueIsFalse) {
202202
EXPECT_THAT(nullptr, Not(IsTrue()));
203203
EXPECT_THAT(nullptr, IsFalse());
204204
std::unique_ptr<int> null_unique;
205-
std::unique_ptr<int> nonnull_unique(new int(0));
205+
std::unique_ptr<int> nonnull_unique = std::make_unique<int>(0);
206206
EXPECT_THAT(null_unique, Not(IsTrue()));
207207
EXPECT_THAT(null_unique, IsFalse());
208208
EXPECT_THAT(nonnull_unique, IsTrue());
@@ -1665,7 +1665,7 @@ MATCHER(IsNotNull, "") { return arg != nullptr; }
16651665
// Verifies that a matcher defined using MATCHER() can work on
16661666
// move-only types.
16671667
TEST(MatcherMacroTest, WorksOnMoveOnlyType) {
1668-
std::unique_ptr<int> p(new int(3));
1668+
std::unique_ptr<int> p = std::make_unique<int>(3);
16691669
EXPECT_THAT(p, IsNotNull());
16701670
EXPECT_THAT(std::unique_ptr<int>(), Not(IsNotNull()));
16711671
}
@@ -1675,7 +1675,7 @@ MATCHER_P(UniquePointee, pointee, "") { return *arg == pointee; }
16751675
// Verifies that a matcher defined using MATCHER_P*() can work on
16761676
// move-only types.
16771677
TEST(MatcherPMacroTest, WorksOnMoveOnlyType) {
1678-
std::unique_ptr<int> p(new int(3));
1678+
std::unique_ptr<int> p = std::make_unique<int>(3);
16791679
EXPECT_THAT(p, UniquePointee(3));
16801680
EXPECT_THAT(p, Not(UniquePointee(2)));
16811681
}

0 commit comments

Comments
 (0)