diff options
author | Gennadiy Civil <gennadiycivil@users.noreply.github.com> | 2017-07-26 16:52:02 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-07-26 16:52:02 -0400 |
commit | e5b88b227e6adfa7196575b1264384e718d16cab (patch) | |
tree | 1f85eb04a9b9f59d013020405e53dde43f737703 /googlemock/docs/v1_6 | |
parent | 6527ee0624b24e1603d8e30df20062570064c851 (diff) | |
parent | 0ffd8629c9ee58ee84ec38768a5cc45faebfa297 (diff) | |
download | googletest-e5b88b227e6adfa7196575b1264384e718d16cab.tar.gz googletest-e5b88b227e6adfa7196575b1264384e718d16cab.tar.bz2 googletest-e5b88b227e6adfa7196575b1264384e718d16cab.zip |
Merge pull request #1137 from coryan/master
Fix table formatting.
Diffstat (limited to 'googlemock/docs/v1_6')
-rw-r--r-- | googlemock/docs/v1_6/CookBook.md | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/googlemock/docs/v1_6/CookBook.md b/googlemock/docs/v1_6/CookBook.md index f5975a00..e77a781c 100644 --- a/googlemock/docs/v1_6/CookBook.md +++ b/googlemock/docs/v1_6/CookBook.md @@ -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 destroyed, 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 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 @@ -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` | |