commit
						e5b88b227e
					
				| @ -1029,9 +1029,10 @@ a value that satisfies matcher `m`. | |||||||
| 
 | 
 | ||||||
| For example: | 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 | Note that in `Property(&Foo::baz, ...)`, method `baz()` must take no | ||||||
| argument and be declared as `const`. | argument and be declared as `const`. | ||||||
| @ -1919,9 +1920,9 @@ using ::testing::_; | |||||||
|   // second argument DoThis() receives. |   // second argument DoThis() receives. | ||||||
| ``` | ``` | ||||||
| 
 | 
 | ||||||
| Arghh, you need to refer to a mock function argument but C++ has no | Arghh, you need to refer to a mock function argument but your version | ||||||
| lambda (yet), so you have to define your own action. :-( Or do you | of C++ has no lambdas, so you have to define your own action. :-( | ||||||
| really? | Or do you really? | ||||||
| 
 | 
 | ||||||
| Well, Google Mock has an action to solve _exactly_ this problem: | Well, Google Mock has an action to solve _exactly_ this problem: | ||||||
| 
 | 
 | ||||||
| @ -2482,12 +2483,12 @@ MockFoo::~MockFoo() {} | |||||||
| 
 | 
 | ||||||
| ## Forcing a Verification ## | ## Forcing a Verification ## | ||||||
| 
 | 
 | ||||||
| When it's being destoyed, your friendly mock object will automatically | When it's being destroyed, your friendly mock object will automatically | ||||||
| verify that all expectations on it have been satisfied, and will | verify that all expectations on it have been satisfied, and will | ||||||
| generate [Google Test](../../googletest/) failures | generate [Google Test](../../googletest/) failures | ||||||
| if not. This is convenient as it leaves you with one less thing to | 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 | worry about. That is, unless you are not sure if your mock object will | ||||||
| be destoyed. | be destroyed. | ||||||
| 
 | 
 | ||||||
| How could it be that your mock object won't eventually be destroyed? | 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 | 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); | int DoSomething(bool flag, int* ptr); | ||||||
| ``` | ``` | ||||||
| we have: | we have: | ||||||
|  | 
 | ||||||
| | **Pre-defined Symbol** | **Is Bound To** | | | **Pre-defined Symbol** | **Is Bound To** | | ||||||
| |:-----------------------|:----------------| | |:-----------------------|:----------------| | ||||||
| | `arg0`                 | the value of `flag` | | | `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 | 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 | 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: | the action and the parameter types.  The rule is relatively simple: | ||||||
|  | 
 | ||||||
| | **Given Definition** | **Expression** | **Has Type** | | | **Given Definition** | **Expression** | **Has Type** | | ||||||
| |:---------------------|:---------------|:-------------| | |:---------------------|:---------------|:-------------| | ||||||
| | `ACTION(Foo)`        | `Foo()`        | `FooAction`  | | | `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_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_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_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`, | Note that we have to pick different suffixes (`Action`, `ActionP`, | ||||||
|  | |||||||
| @ -1032,9 +1032,10 @@ a value that satisfies matcher `m`. | |||||||
| 
 | 
 | ||||||
| For example: | 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 | Note that in `Property(&Foo::baz, ...)`, method `baz()` must take no | ||||||
| argument and be declared as `const`. | argument and be declared as `const`. | ||||||
| @ -1772,9 +1773,9 @@ using ::testing::_; | |||||||
|   // second argument DoThis() receives. |   // second argument DoThis() receives. | ||||||
| ``` | ``` | ||||||
| 
 | 
 | ||||||
| Arghh, you need to refer to a mock function argument but C++ has no | Arghh, you need to refer to a mock function argument but your version | ||||||
| lambda (yet), so you have to define your own action. :-( Or do you | of C++ has no lambdas, so you have to define your own action. :-( | ||||||
| really? | Or do you really? | ||||||
| 
 | 
 | ||||||
| Well, Google Mock has an action to solve _exactly_ this problem: | Well, Google Mock has an action to solve _exactly_ this problem: | ||||||
| 
 | 
 | ||||||
| @ -2080,12 +2081,12 @@ versus | |||||||
| 
 | 
 | ||||||
| ## Forcing a Verification ## | ## Forcing a Verification ## | ||||||
| 
 | 
 | ||||||
| When it's being destoyed, your friendly mock object will automatically | When it's being destroyed, your friendly mock object will automatically | ||||||
| verify that all expectations on it have been satisfied, and will | verify that all expectations on it have been satisfied, and will | ||||||
| generate [Google Test](http://code.google.com/p/googletest/) failures | generate [Google Test](http://code.google.com/p/googletest/) failures | ||||||
| if not. This is convenient as it leaves you with one less thing to | 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 | worry about. That is, unless you are not sure if your mock object will | ||||||
| be destoyed. | be destroyed. | ||||||
| 
 | 
 | ||||||
| How could it be that your mock object won't eventually be destroyed? | 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 | 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); | int DoSomething(bool flag, int* ptr); | ||||||
| ``` | ``` | ||||||
| we have: | we have: | ||||||
|  | 
 | ||||||
| | **Pre-defined Symbol** | **Is Bound To** | | | **Pre-defined Symbol** | **Is Bound To** | | ||||||
| |:-----------------------|:----------------| | |:-----------------------|:----------------| | ||||||
| | `arg0`                 | the value of `flag` | | | `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 | 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 | 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: | the action and the parameter types.  The rule is relatively simple: | ||||||
|  | 
 | ||||||
| | **Given Definition** | **Expression** | **Has Type** | | | **Given Definition** | **Expression** | **Has Type** | | ||||||
| |:---------------------|:---------------|:-------------| | |:---------------------|:---------------|:-------------| | ||||||
| | `ACTION(Foo)`        | `Foo()`        | `FooAction`  | | | `ACTION(Foo)`        | `Foo()`        | `FooAction`  | | ||||||
|  | |||||||
| @ -1037,9 +1037,10 @@ a value that satisfies matcher `m`. | |||||||
| 
 | 
 | ||||||
| For example: | 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 | Note that in `Property(&Foo::baz, ...)`, method `baz()` must take no | ||||||
| argument and be declared as `const`. | argument and be declared as `const`. | ||||||
| @ -1840,9 +1841,9 @@ using ::testing::_; | |||||||
|   // second argument DoThis() receives. |   // second argument DoThis() receives. | ||||||
| ``` | ``` | ||||||
| 
 | 
 | ||||||
| Arghh, you need to refer to a mock function argument but C++ has no | Arghh, you need to refer to a mock function argument but your version | ||||||
| lambda (yet), so you have to define your own action. :-( Or do you | of C++ has no lambdas, so you have to define your own action. :-( | ||||||
| really? | Or do you really? | ||||||
| 
 | 
 | ||||||
| Well, Google Mock has an action to solve _exactly_ this problem: | Well, Google Mock has an action to solve _exactly_ this problem: | ||||||
| 
 | 
 | ||||||
| @ -2211,12 +2212,12 @@ MockFoo::~MockFoo() {} | |||||||
| 
 | 
 | ||||||
| ## Forcing a Verification ## | ## Forcing a Verification ## | ||||||
| 
 | 
 | ||||||
| When it's being destoyed, your friendly mock object will automatically | When it's being destroyed, your friendly mock object will automatically | ||||||
| verify that all expectations on it have been satisfied, and will | verify that all expectations on it have been satisfied, and will | ||||||
| generate [Google Test](http://code.google.com/p/googletest/) failures | generate [Google Test](http://code.google.com/p/googletest/) failures | ||||||
| if not. This is convenient as it leaves you with one less thing to | 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 | worry about. That is, unless you are not sure if your mock object will | ||||||
| be destoyed. | be destroyed. | ||||||
| 
 | 
 | ||||||
| How could it be that your mock object won't eventually be destroyed? | 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 | 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); | int DoSomething(bool flag, int* ptr); | ||||||
| ``` | ``` | ||||||
| we have: | we have: | ||||||
|  | 
 | ||||||
| | **Pre-defined Symbol** | **Is Bound To** | | | **Pre-defined Symbol** | **Is Bound To** | | ||||||
| |:-----------------------|:----------------| | |:-----------------------|:----------------| | ||||||
| | `arg0`                 | the value of `flag` | | | `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 | 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 | 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: | the action and the parameter types.  The rule is relatively simple: | ||||||
|  | 
 | ||||||
| | **Given Definition** | **Expression** | **Has Type** | | | **Given Definition** | **Expression** | **Has Type** | | ||||||
| |:---------------------|:---------------|:-------------| | |:---------------------|:---------------|:-------------| | ||||||
| | `ACTION(Foo)`        | `Foo()`        | `FooAction`  | | | `ACTION(Foo)`        | `Foo()`        | `FooAction`  | | ||||||
|  | |||||||
| @ -1030,9 +1030,10 @@ a value that satisfies matcher `m`. | |||||||
| 
 | 
 | ||||||
| For example: | 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 | Note that in `Property(&Foo::baz, ...)`, method `baz()` must take no | ||||||
| argument and be declared as `const`. | argument and be declared as `const`. | ||||||
| @ -1868,9 +1869,9 @@ using ::testing::_; | |||||||
|   // second argument DoThis() receives. |   // second argument DoThis() receives. | ||||||
| ``` | ``` | ||||||
| 
 | 
 | ||||||
| Arghh, you need to refer to a mock function argument but C++ has no | Arghh, you need to refer to a mock function argument but your version | ||||||
| lambda (yet), so you have to define your own action. :-( Or do you | of C++ has no lambdas, so you have to define your own action. :-( | ||||||
| really? | Or do you really? | ||||||
| 
 | 
 | ||||||
| Well, Google Mock has an action to solve _exactly_ this problem: | Well, Google Mock has an action to solve _exactly_ this problem: | ||||||
| 
 | 
 | ||||||
| @ -2239,12 +2240,12 @@ MockFoo::~MockFoo() {} | |||||||
| 
 | 
 | ||||||
| ## Forcing a Verification ## | ## Forcing a Verification ## | ||||||
| 
 | 
 | ||||||
| When it's being destoyed, your friendly mock object will automatically | When it's being destroyed, your friendly mock object will automatically | ||||||
| verify that all expectations on it have been satisfied, and will | verify that all expectations on it have been satisfied, and will | ||||||
| generate [Google Test](http://code.google.com/p/googletest/) failures | generate [Google Test](http://code.google.com/p/googletest/) failures | ||||||
| if not. This is convenient as it leaves you with one less thing to | 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 | worry about. That is, unless you are not sure if your mock object will | ||||||
| be destoyed. | be destroyed. | ||||||
| 
 | 
 | ||||||
| How could it be that your mock object won't eventually be destroyed? | 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 | 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); | int DoSomething(bool flag, int* ptr); | ||||||
| ``` | ``` | ||||||
| we have: | we have: | ||||||
|  | 
 | ||||||
| | **Pre-defined Symbol** | **Is Bound To** | | | **Pre-defined Symbol** | **Is Bound To** | | ||||||
| |:-----------------------|:----------------| | |:-----------------------|:----------------| | ||||||
| | `arg0`                 | the value of `flag` | | | `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 | 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 | 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: | the action and the parameter types.  The rule is relatively simple: | ||||||
|  | 
 | ||||||
| | **Given Definition** | **Expression** | **Has Type** | | | **Given Definition** | **Expression** | **Has Type** | | ||||||
| |:---------------------|:---------------|:-------------| | |:---------------------|:---------------|:-------------| | ||||||
| | `ACTION(Foo)`        | `Foo()`        | `FooAction`  | | | `ACTION(Foo)`        | `Foo()`        | `FooAction`  | | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user