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
e5b88b22
Commit
e5b88b22
authored
Jul 26, 2017
by
Gennadiy Civil
Committed by
GitHub
Jul 26, 2017
Browse files
Merge pull request #1137 from coryan/master
Fix table formatting.
parents
6527ee06
0ffd8629
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
41 additions
and
29 deletions
+41
-29
googlemock/docs/CookBook.md
googlemock/docs/CookBook.md
+11
-8
googlemock/docs/v1_5/CookBook.md
googlemock/docs/v1_5/CookBook.md
+10
-7
googlemock/docs/v1_6/CookBook.md
googlemock/docs/v1_6/CookBook.md
+10
-7
googlemock/docs/v1_7/CookBook.md
googlemock/docs/v1_7/CookBook.md
+10
-7
No files found.
googlemock/docs/CookBook.md
View file @
e5b88b22
...
...
@@ -1029,9 +1029,10 @@ a value that satisfies matcher `m`.
For example:
> | `Field(&Foo::number, Ge(3))` | Matches `x` where `x.number >= 3`.
|
| Expression | Description
|
|:-----------------------------|:-----------------------------------|
> | `Property(&Foo::name, StartsWith("John "))` | Matches `x` where `x.name()` starts with `"John "`. |
|
`Field(&Foo::number, Ge(3))`
| Matches
`x`
where
`x.number >= 3`
. |
|
`Property(&Foo::name, StartsWith("John "))`
| Matches
`x`
where
`x.name()`
starts with
`"John "`
. |
Note that in
`Property(&Foo::baz, ...)`
, method
`baz()`
must take no
argument and be declared as
`const`
.
...
...
@@ -1919,9 +1920,9 @@ using ::testing::_;
// second argument DoThis() receives.
```
Arghh, you need to refer to a mock function argument but
C++ has no
lambda (yet)
, so you have to define your own action. :-(
Or do you
really?
Arghh, you need to refer to a mock function argument but
your version
of C++ has no lambdas
, so you have to define your own action. :-(
Or do you
really?
Well, Google Mock has an action to solve _exactly_ this problem:
...
...
@@ -2482,12 +2483,12 @@ MockFoo::~MockFoo() {}
## Forcing a Verification ##
When it's being destoyed, your friendly mock object will automatically
When it's being dest
r
oyed, your friendly mock object will automatically
verify that all expectations on it have been satisfied, and will
generate
[
Google Test
](
../../googletest/
)
failures
if not. This is convenient as it leaves you with one less thing to
worry about. That is, unless you are not sure if your mock object will
be destoyed.
be dest
r
oyed.
How could it be that your mock object won't eventually be destroyed?
Well, it might be created on the heap and owned by the code you are
...
...
@@ -3347,6 +3348,7 @@ For example, when using an `ACTION` as a stub action for mock function:
int DoSomething(bool flag, int* ptr);
```
we have:
| **Pre-defined Symbol** | **Is Bound To** |
|:-----------------------|:----------------|
| `
arg0
` | the value of `
flag
` |
...
...
@@ -3508,6 +3510,7 @@ is asked to infer the type of `x`?
If you are writing a function that returns an `
ACTION
` object, you'll
need to know its type. The type depends on the macro used to define
the action and the parameter types. The rule is relatively simple:
| **Given Definition** | **Expression** | **Has Type** |
|:---------------------|:---------------|:-------------|
| `
ACTION(Foo)
` | `
Foo()
` | `
FooAction
` |
...
...
@@ -3515,7 +3518,7 @@ the action and the parameter types. The rule is relatively simple:
| `
ACTION_P(Bar, param)
` | `
Bar(int_value)
` | `
BarActionP
<int>
` |
| `
ACTION_TEMPLATE(Bar, HAS_m_TEMPLATE_PARAMS(...), AND_1_VALUE_PARAMS(p1))
` | `
Bar
<t1
,
...,
t_m
>
(int_value)
` | `
FooActionP
<t1
,
...,
t_m
,
int
>
` |
| `
ACTION_P2(Baz, p1, p2)
` | `
Baz(bool_value, int_value)
` | `
BazActionP2
<bool
,
int
>
` |
| `
ACTION_TEMPLATE(Baz, HAS_m_TEMPLATE_PARAMS(...), AND_2_VALUE_PARAMS(p1, p2))
`
| `
Baz
<t1
,
...,
t_m
>
(bool_value, int_value)
` | `
FooActionP2
<t1
,
...,
t_m
,
bool
,
int
>
` |
| `
ACTION_TEMPLATE(Baz, HAS_m_TEMPLATE_PARAMS(...), AND_2_VALUE_PARAMS(p1, p2))
`| `
Baz
<t1
,
...,
t_m
>
(bool_value, int_value)
` | `
FooActionP2
<t1
,
...,
t_m
,
bool
,
int
>
` |
| ... | ... | ... |
Note that we have to pick different suffixes (`
Action
`, `
ActionP
`,
...
...
googlemock/docs/v1_5/CookBook.md
View file @
e5b88b22
...
...
@@ -1032,9 +1032,10 @@ a value that satisfies matcher `m`.
For example:
> | `Field(&Foo::number, Ge(3))` | Matches `x` where `x.number >= 3`.
|
| Expression | Description
|
|:-----------------------------|:-----------------------------------|
> | `Property(&Foo::name, StartsWith("John "))` | Matches `x` where `x.name()` starts with `"John "`. |
|
`Field(&Foo::number, Ge(3))`
| Matches
`x`
where
`x.number >= 3`
. |
|
`Property(&Foo::name, StartsWith("John "))`
| Matches
`x`
where
`x.name()`
starts with
`"John "`
. |
Note that in
`Property(&Foo::baz, ...)`
, method
`baz()`
must take no
argument and be declared as
`const`
.
...
...
@@ -1772,9 +1773,9 @@ using ::testing::_;
// second argument DoThis() receives.
```
Arghh, you need to refer to a mock function argument but
C++ has no
lambda (yet)
, so you have to define your own action. :-(
Or do you
really?
Arghh, you need to refer to a mock function argument but
your version
of C++ has no lambdas
, so you have to define your own action. :-(
Or do you
really?
Well, Google Mock has an action to solve _exactly_ this problem:
...
...
@@ -2080,12 +2081,12 @@ versus
## Forcing a Verification ##
When it's being destoyed, your friendly mock object will automatically
When it's being dest
r
oyed, your friendly mock object will automatically
verify that all expectations on it have been satisfied, and will
generate
[
Google Test
](
http://code.google.com/p/googletest/
)
failures
if not. This is convenient as it leaves you with one less thing to
worry about. That is, unless you are not sure if your mock object will
be destoyed.
be dest
r
oyed.
How could it be that your mock object won't eventually be destroyed?
Well, it might be created on the heap and owned by the code you are
...
...
@@ -2863,6 +2864,7 @@ For example, when using an `ACTION` as a stub action for mock function:
int DoSomething(bool flag, int* ptr);
```
we have:
| **Pre-defined Symbol** | **Is Bound To** |
|:-----------------------|:----------------|
| `
arg0
` | the value of `
flag
` |
...
...
@@ -3024,6 +3026,7 @@ is asked to infer the type of `x`?
If you are writing a function that returns an `
ACTION
` object, you'll
need to know its type. The type depends on the macro used to define
the action and the parameter types. The rule is relatively simple:
| **Given Definition** | **Expression** | **Has Type** |
|:---------------------|:---------------|:-------------|
| `
ACTION(Foo)
` | `
Foo()
` | `
FooAction
` |
...
...
googlemock/docs/v1_6/CookBook.md
View file @
e5b88b22
...
...
@@ -1037,9 +1037,10 @@ a value that satisfies matcher `m`.
For example:
> | `Field(&Foo::number, Ge(3))` | Matches `x` where `x.number >= 3`.
|
| Expression | Description
|
|:-----------------------------|:-----------------------------------|
> | `Property(&Foo::name, StartsWith("John "))` | Matches `x` where `x.name()` starts with `"John "`. |
|
`Field(&Foo::number, Ge(3))`
| Matches
`x`
where
`x.number >= 3`
. |
|
`Property(&Foo::name, StartsWith("John "))`
| Matches
`x`
where
`x.name()`
starts with
`"John "`
. |
Note that in
`Property(&Foo::baz, ...)`
, method
`baz()`
must take no
argument and be declared as
`const`
.
...
...
@@ -1840,9 +1841,9 @@ using ::testing::_;
// second argument DoThis() receives.
```
Arghh, you need to refer to a mock function argument but
C++ has no
lambda (yet)
, so you have to define your own action. :-(
Or do you
really?
Arghh, you need to refer to a mock function argument but
your version
of C++ has no lambdas
, so you have to define your own action. :-(
Or do you
really?
Well, Google Mock has an action to solve _exactly_ this problem:
...
...
@@ -2211,12 +2212,12 @@ MockFoo::~MockFoo() {}
## Forcing a Verification ##
When it's being destoyed, your friendly mock object will automatically
When it's being dest
r
oyed, your friendly mock object will automatically
verify that all expectations on it have been satisfied, and will
generate
[
Google Test
](
http://code.google.com/p/googletest/
)
failures
if not. This is convenient as it leaves you with one less thing to
worry about. That is, unless you are not sure if your mock object will
be destoyed.
be dest
r
oyed.
How could it be that your mock object won't eventually be destroyed?
Well, it might be created on the heap and owned by the code you are
...
...
@@ -3014,6 +3015,7 @@ For example, when using an `ACTION` as a stub action for mock function:
int DoSomething(bool flag, int* ptr);
```
we have:
| **Pre-defined Symbol** | **Is Bound To** |
|:-----------------------|:----------------|
| `
arg0
` | the value of `
flag
` |
...
...
@@ -3175,6 +3177,7 @@ is asked to infer the type of `x`?
If you are writing a function that returns an `
ACTION
` object, you'll
need to know its type. The type depends on the macro used to define
the action and the parameter types. The rule is relatively simple:
| **Given Definition** | **Expression** | **Has Type** |
|:---------------------|:---------------|:-------------|
| `
ACTION(Foo)
` | `
Foo()
` | `
FooAction
` |
...
...
googlemock/docs/v1_7/CookBook.md
View file @
e5b88b22
...
...
@@ -1030,9 +1030,10 @@ a value that satisfies matcher `m`.
For example:
> | `Field(&Foo::number, Ge(3))` | Matches `x` where `x.number >= 3`.
|
| Expression | Description
|
|:-----------------------------|:-----------------------------------|
> | `Property(&Foo::name, StartsWith("John "))` | Matches `x` where `x.name()` starts with `"John "`. |
|
`Field(&Foo::number, Ge(3))`
| Matches
`x`
where
`x.number >= 3`
. |
|
`Property(&Foo::name, StartsWith("John "))`
| Matches
`x`
where
`x.name()`
starts with
`"John "`
. |
Note that in
`Property(&Foo::baz, ...)`
, method
`baz()`
must take no
argument and be declared as
`const`
.
...
...
@@ -1868,9 +1869,9 @@ using ::testing::_;
// second argument DoThis() receives.
```
Arghh, you need to refer to a mock function argument but
C++ has no
lambda (yet)
, so you have to define your own action. :-(
Or do you
really?
Arghh, you need to refer to a mock function argument but
your version
of C++ has no lambdas
, so you have to define your own action. :-(
Or do you
really?
Well, Google Mock has an action to solve _exactly_ this problem:
...
...
@@ -2239,12 +2240,12 @@ MockFoo::~MockFoo() {}
## Forcing a Verification ##
When it's being destoyed, your friendly mock object will automatically
When it's being dest
r
oyed, your friendly mock object will automatically
verify that all expectations on it have been satisfied, and will
generate
[
Google Test
](
http://code.google.com/p/googletest/
)
failures
if not. This is convenient as it leaves you with one less thing to
worry about. That is, unless you are not sure if your mock object will
be destoyed.
be dest
r
oyed.
How could it be that your mock object won't eventually be destroyed?
Well, it might be created on the heap and owned by the code you are
...
...
@@ -3104,6 +3105,7 @@ For example, when using an `ACTION` as a stub action for mock function:
int DoSomething(bool flag, int* ptr);
```
we have:
| **Pre-defined Symbol** | **Is Bound To** |
|:-----------------------|:----------------|
| `
arg0
` | the value of `
flag
` |
...
...
@@ -3265,6 +3267,7 @@ is asked to infer the type of `x`?
If you are writing a function that returns an `
ACTION
` object, you'll
need to know its type. The type depends on the macro used to define
the action and the parameter types. The rule is relatively simple:
| **Given Definition** | **Expression** | **Has Type** |
|:---------------------|:---------------|:-------------|
| `
ACTION(Foo)
` | `
Foo()
` | `
FooAction
` |
...
...
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