Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
yangql
googletest
Commits
834698cc
Commit
834698cc
authored
Nov 20, 2022
by
Denis Hananein
Browse files
Change MakeUnique -> std::make_unique in docs
parent
9c332145
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
5 deletions
+5
-5
docs/gmock_cheat_sheet.md
docs/gmock_cheat_sheet.md
+1
-1
docs/gmock_cook_book.md
docs/gmock_cook_book.md
+4
-4
No files found.
docs/gmock_cheat_sheet.md
View file @
834698cc
...
...
@@ -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
// creating a new Buzz every time.
DefaultValue
<
std
::
unique_ptr
<
Buzz
>>::
SetFactory
(
[]
{
return
M
ake
U
nique
<
Buzz
>
(
AccessLevel
::
kInternal
);
});
[]
{
return
std
::
m
ake
_u
nique
<
Buzz
>
(
AccessLevel
::
kInternal
);
});
// When this fires, the default action of MakeBuzz() will run, which
// will return a new Buzz object.
...
...
docs/gmock_cook_book.md
View file @
834698cc
...
...
@@ -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
// be returned.
EXPECT_CALL
(
mock_buzzer_
,
MakeBuzz
(
"world"
))
.
WillOnce
(
Return
(
ByMove
(
M
ake
U
nique
<
Buzz
>
(
AccessLevel
::
kInternal
))));
.
WillOnce
(
Return
(
ByMove
(
std
::
m
ake
_u
nique
<
Buzz
>
(
AccessLevel
::
kInternal
))));
EXPECT_NE
(
nullptr
,
mock_buzzer_
.
MakeBuzz
(
"world"
));
```
...
...
@@ -2805,7 +2805,7 @@ pretty much anything you want:
```
cpp
EXPECT_CALL
(
mock_buzzer_
,
MakeBuzz
(
"x"
))
.
WillRepeatedly
([](
StringPiece
text
)
{
return
M
ake
U
nique
<
Buzz
>
(
AccessLevel
::
kInternal
);
return
std
::
m
ake
_u
nique
<
Buzz
>
(
AccessLevel
::
kInternal
);
});
EXPECT_NE
(
nullptr
,
mock_buzzer_
.
MakeBuzz
(
"x"
));
...
...
@@ -2824,7 +2824,7 @@ can always use `Return`, or a [lambda or functor](#FunctionsAsActions):
using
::
testing
::
Unused
;
EXPECT_CALL
(
mock_buzzer_
,
ShareBuzz
(
NotNull
(),
_
)).
WillOnce
(
Return
(
true
));
EXPECT_TRUE
(
mock_buzzer_
.
ShareBuzz
(
M
ake
U
nique
<
Buzz
>
(
AccessLevel
::
kInternal
)),
EXPECT_TRUE
(
mock_buzzer_
.
ShareBuzz
(
std
::
m
ake
_u
nique
<
Buzz
>
(
AccessLevel
::
kInternal
)),
0
);
EXPECT_CALL
(
mock_buzzer_
,
ShareBuzz
(
_
,
_
)).
WillOnce
(
...
...
@@ -2868,7 +2868,7 @@ method:
// When one calls ShareBuzz() on the MockBuzzer like this, the call is
// forwarded to DoShareBuzz(), which is mocked. Therefore this statement
// will trigger the above EXPECT_CALL.
mock_buzzer_
.
ShareBuzz
(
M
ake
U
nique
<
Buzz
>
(
AccessLevel
::
kInternal
),
0
);
mock_buzzer_
.
ShareBuzz
(
std
::
m
ake
_u
nique
<
Buzz
>
(
AccessLevel
::
kInternal
),
0
);
```
### Making the Compilation Faster
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment