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
b6323d21
Commit
b6323d21
authored
Feb 02, 2021
by
Abseil Team
Committed by
Dino Radaković
Feb 05, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Googletest export
Add a note to recommend against using `Property()` for functions that the test author does not own. PiperOrigin-RevId: 355295183
parent
aea7f60b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
2 deletions
+10
-2
gmock_cheat_sheet.md
docs/gmock_cheat_sheet.md
+6
-0
gmock_cook_book.md
docs/gmock_cook_book.md
+4
-2
No files found.
docs/gmock_cheat_sheet.md
View file @
b6323d21
...
@@ -400,6 +400,12 @@ messages, you can use:
...
@@ -400,6 +400,12 @@ messages, you can use:
|
`Property(property_name, &class::property, m)`
| The same as the two-parameter version, but provides a better error message.
|
`Property(property_name, &class::property, m)`
| The same as the two-parameter version, but provides a better error message.
<!-- mdformat on -->
<!-- mdformat on -->
**Notes:**
*
Don't use
`Property()`
against member functions that you do not own, because
taking addresses of functions is fragile and generally not part of the
contract of the function.
### Matching the Result of a Function, Functor, or Callback
### Matching the Result of a Function, Functor, or Callback
<!-- mdformat off(no multiline tables) -->
<!-- mdformat off(no multiline tables) -->
...
...
docs/gmock_cook_book.md
View file @
b6323d21
...
@@ -1216,9 +1216,11 @@ For example:
...
@@ -1216,9 +1216,11 @@ For example:
<!-- mdformat on -->
<!-- mdformat on -->
Note that in
`Property(&Foo::baz, ...)`
, method
`baz()`
must take no argument
Note that in
`Property(&Foo::baz, ...)`
, method
`baz()`
must take no argument
and be declared as
`const`
.
and be declared as
`const`
. Don't use
`Property()`
against member functions that
you do not own, because taking addresses of functions is fragile and generally
not part of the contract of the function.
BTW,
`Field()`
and
`Property()`
can also match plain pointers to objects. For
`Field()`
and
`Property()`
can also match plain pointers to objects. For
instance,
instance,
```
cpp
```
cpp
...
...
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