mirror of
https://github.com/google/googletest.git
synced 2025-01-14 16:37:56 +08:00
Change MakeUnique -> std::make_unique in docs
This commit is contained in:
parent
9c332145b7
commit
834698cc9b
@ -140,7 +140,7 @@ To customize the default action for functions with return type `T`, use
|
|||||||
// Sets the default action for return type std::unique_ptr<Buzz> to
|
// Sets the default action for return type std::unique_ptr<Buzz> to
|
||||||
// creating a new Buzz every time.
|
// creating a new Buzz every time.
|
||||||
DefaultValue<std::unique_ptr<Buzz>>::SetFactory(
|
DefaultValue<std::unique_ptr<Buzz>>::SetFactory(
|
||||||
[] { return MakeUnique<Buzz>(AccessLevel::kInternal); });
|
[] { return std::make_unique<Buzz>(AccessLevel::kInternal); });
|
||||||
|
|
||||||
// When this fires, the default action of MakeBuzz() will run, which
|
// When this fires, the default action of MakeBuzz() will run, which
|
||||||
// will return a new Buzz object.
|
// will return a new Buzz object.
|
||||||
|
@ -2784,7 +2784,7 @@ If you just need to return a pre-defined move-only value, you can use the
|
|||||||
// When this fires, the unique_ptr<> specified by ByMove(...) will
|
// When this fires, the unique_ptr<> specified by ByMove(...) will
|
||||||
// be returned.
|
// be returned.
|
||||||
EXPECT_CALL(mock_buzzer_, MakeBuzz("world"))
|
EXPECT_CALL(mock_buzzer_, MakeBuzz("world"))
|
||||||
.WillOnce(Return(ByMove(MakeUnique<Buzz>(AccessLevel::kInternal))));
|
.WillOnce(Return(ByMove(std::make_unique<Buzz>(AccessLevel::kInternal))));
|
||||||
|
|
||||||
EXPECT_NE(nullptr, mock_buzzer_.MakeBuzz("world"));
|
EXPECT_NE(nullptr, mock_buzzer_.MakeBuzz("world"));
|
||||||
```
|
```
|
||||||
@ -2805,7 +2805,7 @@ pretty much anything you want:
|
|||||||
```cpp
|
```cpp
|
||||||
EXPECT_CALL(mock_buzzer_, MakeBuzz("x"))
|
EXPECT_CALL(mock_buzzer_, MakeBuzz("x"))
|
||||||
.WillRepeatedly([](StringPiece text) {
|
.WillRepeatedly([](StringPiece text) {
|
||||||
return MakeUnique<Buzz>(AccessLevel::kInternal);
|
return std::make_unique<Buzz>(AccessLevel::kInternal);
|
||||||
});
|
});
|
||||||
|
|
||||||
EXPECT_NE(nullptr, mock_buzzer_.MakeBuzz("x"));
|
EXPECT_NE(nullptr, mock_buzzer_.MakeBuzz("x"));
|
||||||
@ -2824,7 +2824,7 @@ can always use `Return`, or a [lambda or functor](#FunctionsAsActions):
|
|||||||
using ::testing::Unused;
|
using ::testing::Unused;
|
||||||
|
|
||||||
EXPECT_CALL(mock_buzzer_, ShareBuzz(NotNull(), _)).WillOnce(Return(true));
|
EXPECT_CALL(mock_buzzer_, ShareBuzz(NotNull(), _)).WillOnce(Return(true));
|
||||||
EXPECT_TRUE(mock_buzzer_.ShareBuzz(MakeUnique<Buzz>(AccessLevel::kInternal)),
|
EXPECT_TRUE(mock_buzzer_.ShareBuzz(std::make_unique<Buzz>(AccessLevel::kInternal)),
|
||||||
0);
|
0);
|
||||||
|
|
||||||
EXPECT_CALL(mock_buzzer_, ShareBuzz(_, _)).WillOnce(
|
EXPECT_CALL(mock_buzzer_, ShareBuzz(_, _)).WillOnce(
|
||||||
@ -2868,7 +2868,7 @@ method:
|
|||||||
// When one calls ShareBuzz() on the MockBuzzer like this, the call is
|
// When one calls ShareBuzz() on the MockBuzzer like this, the call is
|
||||||
// forwarded to DoShareBuzz(), which is mocked. Therefore this statement
|
// forwarded to DoShareBuzz(), which is mocked. Therefore this statement
|
||||||
// will trigger the above EXPECT_CALL.
|
// will trigger the above EXPECT_CALL.
|
||||||
mock_buzzer_.ShareBuzz(MakeUnique<Buzz>(AccessLevel::kInternal), 0);
|
mock_buzzer_.ShareBuzz(std::make_unique<Buzz>(AccessLevel::kInternal), 0);
|
||||||
```
|
```
|
||||||
|
|
||||||
### Making the Compilation Faster
|
### Making the Compilation Faster
|
||||||
|
Loading…
x
Reference in New Issue
Block a user