Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
googletest
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
googletest
Commits
208c2f6b
Commit
208c2f6b
authored
Oct 25, 2019
by
Piotr Nycz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
variable names corrected (followed google coding style)
Issue 2527
parent
5ff72f52
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
14 deletions
+14
-14
gmock-actions_test.cc
googlemock/test/gmock-actions_test.cc
+14
-14
No files found.
googlemock/test/gmock-actions_test.cc
View file @
208c2f6b
...
...
@@ -653,33 +653,33 @@ bool CanCallReturnRef(Unused) { return false; }
// Tests that ReturnRef(v) is working with non-temporaries (T&)
TEST
(
ReturnRefTest
,
WorksForNonTemporary
)
{
int
scalar
V
alue
=
123
;
EXPECT_TRUE
(
CanCallReturnRef
(
scalar
V
alue
));
int
scalar
_v
alue
=
123
;
EXPECT_TRUE
(
CanCallReturnRef
(
scalar
_v
alue
));
std
::
string
non
ScalarV
alue
(
"ABC"
);
EXPECT_TRUE
(
CanCallReturnRef
(
non
ScalarV
alue
));
std
::
string
non
_scalar_v
alue
(
"ABC"
);
EXPECT_TRUE
(
CanCallReturnRef
(
non
_scalar_v
alue
));
const
int
const
ScalarV
alue
{
321
};
EXPECT_TRUE
(
CanCallReturnRef
(
const
ScalarV
alue
));
const
int
const
_scalar_v
alue
{
321
};
EXPECT_TRUE
(
CanCallReturnRef
(
const
_scalar_v
alue
));
const
std
::
string
const
NonScalarV
alue
(
"CBA"
);
EXPECT_TRUE
(
CanCallReturnRef
(
const
NonScalarV
alue
));
const
std
::
string
const
_non_scalar_v
alue
(
"CBA"
);
EXPECT_TRUE
(
CanCallReturnRef
(
const
_non_scalar_v
alue
));
}
// Tests that ReturnRef(v) is not working with temporaries (T&&)
TEST
(
ReturnRefTest
,
DoesNotWorkForTemporary
)
{
auto
scalar
V
alue
=
[]()
->
int
{
return
123
;
};
EXPECT_FALSE
(
CanCallReturnRef
(
scalar
V
alue
()));
auto
scalar
_v
alue
=
[]()
->
int
{
return
123
;
};
EXPECT_FALSE
(
CanCallReturnRef
(
scalar
_v
alue
()));
auto
non
ScalarV
alue
=
[]()
->
std
::
string
{
return
"ABC"
;
};
EXPECT_FALSE
(
CanCallReturnRef
(
non
ScalarV
alue
()));
auto
non
_scalar_v
alue
=
[]()
->
std
::
string
{
return
"ABC"
;
};
EXPECT_FALSE
(
CanCallReturnRef
(
non
_scalar_v
alue
()));
// cannot use here callable returning "const scalar type",
// because such const for scalar return type is ignored
EXPECT_FALSE
(
CanCallReturnRef
(
static_cast
<
const
int
>
(
321
)));
auto
const
NonScalarV
alue
=
[]()
->
const
std
::
string
{
return
"CBA"
;
};
EXPECT_FALSE
(
CanCallReturnRef
(
const
NonScalarV
alue
()));
auto
const
_non_scalar_v
alue
=
[]()
->
const
std
::
string
{
return
"CBA"
;
};
EXPECT_FALSE
(
CanCallReturnRef
(
const
_non_scalar_v
alue
()));
}
// Tests that ReturnRefOfCopy(v) works for reference types.
...
...
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