From 280b22708c014bd29a51eee5982e941231c7925f Mon Sep 17 00:00:00 2001 From: Carlos O'Ryan Date: Sat, 1 Jul 2017 09:51:45 -0400 Subject: [PATCH 1/5] Fix table formatting. The markdown was not working for a small table, fixed. --- googlemock/docs/v1_5/CookBook.md | 5 +++-- googlemock/docs/v1_6/CookBook.md | 5 +++-- googlemock/docs/v1_7/CookBook.md | 5 +++-- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/googlemock/docs/v1_5/CookBook.md b/googlemock/docs/v1_5/CookBook.md index 26e153c6..6da89fc2 100644 --- a/googlemock/docs/v1_5/CookBook.md +++ b/googlemock/docs/v1_5/CookBook.md @@ -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`. diff --git a/googlemock/docs/v1_6/CookBook.md b/googlemock/docs/v1_6/CookBook.md index f5975a00..46a2ea1f 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`. diff --git a/googlemock/docs/v1_7/CookBook.md b/googlemock/docs/v1_7/CookBook.md index 419a0010..60024075 100644 --- a/googlemock/docs/v1_7/CookBook.md +++ b/googlemock/docs/v1_7/CookBook.md @@ -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`. From 1dde1eed381a68af1e1a2ea477c26b3b1ead716b Mon Sep 17 00:00:00 2001 From: Carlos O'Ryan Date: Sat, 1 Jul 2017 15:26:42 -0400 Subject: [PATCH 2/5] Fix typos too s/destoyed/destroyed/ --- googlemock/docs/v1_5/CookBook.md | 4 ++-- googlemock/docs/v1_6/CookBook.md | 4 ++-- googlemock/docs/v1_7/CookBook.md | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/googlemock/docs/v1_5/CookBook.md b/googlemock/docs/v1_5/CookBook.md index 6da89fc2..f85bc3bf 100644 --- a/googlemock/docs/v1_5/CookBook.md +++ b/googlemock/docs/v1_5/CookBook.md @@ -2081,12 +2081,12 @@ versus ## 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 diff --git a/googlemock/docs/v1_6/CookBook.md b/googlemock/docs/v1_6/CookBook.md index 46a2ea1f..5224661f 100644 --- a/googlemock/docs/v1_6/CookBook.md +++ b/googlemock/docs/v1_6/CookBook.md @@ -2212,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 diff --git a/googlemock/docs/v1_7/CookBook.md b/googlemock/docs/v1_7/CookBook.md index 60024075..94a9a485 100644 --- a/googlemock/docs/v1_7/CookBook.md +++ b/googlemock/docs/v1_7/CookBook.md @@ -2240,12 +2240,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 From f20797bd8dd1c5ea3ae95218abdf3807be497993 Mon Sep 17 00:00:00 2001 From: Carlos O'Ryan Date: Sat, 1 Jul 2017 15:27:07 -0400 Subject: [PATCH 3/5] Same fixes for "current" version. --- googlemock/docs/CookBook.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/googlemock/docs/CookBook.md b/googlemock/docs/CookBook.md index 0460d357..5c1e5b8e 100644 --- a/googlemock/docs/CookBook.md +++ b/googlemock/docs/CookBook.md @@ -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`. @@ -2482,12 +2483,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](../../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 From 2fcbc0c1ab4877f2a149fe2b4760fd2bf182d0b1 Mon Sep 17 00:00:00 2001 From: Carlos O'Ryan Date: Sat, 1 Jul 2017 15:30:55 -0400 Subject: [PATCH 4/5] Remove silly claim that C++ lacks lambdas. The document itself uses lambdas later, all the scaffolding to work around lack of lambdas should be considered for removal, but that is much larger an effort than I can commit to. --- googlemock/docs/CookBook.md | 6 +++--- googlemock/docs/v1_5/CookBook.md | 6 +++--- googlemock/docs/v1_6/CookBook.md | 6 +++--- googlemock/docs/v1_7/CookBook.md | 6 +++--- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/googlemock/docs/CookBook.md b/googlemock/docs/CookBook.md index 5c1e5b8e..4f8e944c 100644 --- a/googlemock/docs/CookBook.md +++ b/googlemock/docs/CookBook.md @@ -1920,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: diff --git a/googlemock/docs/v1_5/CookBook.md b/googlemock/docs/v1_5/CookBook.md index f85bc3bf..0b25d2c5 100644 --- a/googlemock/docs/v1_5/CookBook.md +++ b/googlemock/docs/v1_5/CookBook.md @@ -1773,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: diff --git a/googlemock/docs/v1_6/CookBook.md b/googlemock/docs/v1_6/CookBook.md index 5224661f..16b75a39 100644 --- a/googlemock/docs/v1_6/CookBook.md +++ b/googlemock/docs/v1_6/CookBook.md @@ -1841,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: diff --git a/googlemock/docs/v1_7/CookBook.md b/googlemock/docs/v1_7/CookBook.md index 94a9a485..21cb2cb8 100644 --- a/googlemock/docs/v1_7/CookBook.md +++ b/googlemock/docs/v1_7/CookBook.md @@ -1869,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: From 0ffd8629c9ee58ee84ec38768a5cc45faebfa297 Mon Sep 17 00:00:00 2001 From: Carlos O'Ryan Date: Sat, 1 Jul 2017 22:34:51 -0400 Subject: [PATCH 5/5] More tables that did not render correctly. --- googlemock/docs/CookBook.md | 4 +++- googlemock/docs/v1_5/CookBook.md | 2 ++ googlemock/docs/v1_6/CookBook.md | 2 ++ googlemock/docs/v1_7/CookBook.md | 2 ++ 4 files changed, 9 insertions(+), 1 deletion(-) diff --git a/googlemock/docs/CookBook.md b/googlemock/docs/CookBook.md index 4f8e944c..90071bc0 100644 --- a/googlemock/docs/CookBook.md +++ b/googlemock/docs/CookBook.md @@ -3348,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` | @@ -3509,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` | @@ -3516,7 +3518,7 @@ the action and the parameter types. The rule is relatively simple: | `ACTION_P(Bar, param)` | `Bar(int_value)` | `BarActionP` | | `ACTION_TEMPLATE(Bar, HAS_m_TEMPLATE_PARAMS(...), AND_1_VALUE_PARAMS(p1))` | `Bar(int_value)` | `FooActionP` | | `ACTION_P2(Baz, p1, p2)` | `Baz(bool_value, int_value)` | `BazActionP2` | -| `ACTION_TEMPLATE(Baz, HAS_m_TEMPLATE_PARAMS(...), AND_2_VALUE_PARAMS(p1, p2))` | `Baz(bool_value, int_value)` | `FooActionP2` | +| `ACTION_TEMPLATE(Baz, HAS_m_TEMPLATE_PARAMS(...), AND_2_VALUE_PARAMS(p1, p2))`| `Baz(bool_value, int_value)` | `FooActionP2` | | ... | ... | ... | Note that we have to pick different suffixes (`Action`, `ActionP`, diff --git a/googlemock/docs/v1_5/CookBook.md b/googlemock/docs/v1_5/CookBook.md index 0b25d2c5..55824bbb 100644 --- a/googlemock/docs/v1_5/CookBook.md +++ b/googlemock/docs/v1_5/CookBook.md @@ -2864,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` | @@ -3025,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` | diff --git a/googlemock/docs/v1_6/CookBook.md b/googlemock/docs/v1_6/CookBook.md index 16b75a39..e77a781c 100644 --- a/googlemock/docs/v1_6/CookBook.md +++ b/googlemock/docs/v1_6/CookBook.md @@ -3015,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` | @@ -3176,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` | diff --git a/googlemock/docs/v1_7/CookBook.md b/googlemock/docs/v1_7/CookBook.md index 21cb2cb8..03994890 100644 --- a/googlemock/docs/v1_7/CookBook.md +++ b/googlemock/docs/v1_7/CookBook.md @@ -3105,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` | @@ -3266,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` |