Googletest export
Delete internal tags from docs PiperOrigin-RevId: 353769887
This commit is contained in:
@@ -1,7 +1,5 @@
|
||||
# gMock Cookbook
|
||||
|
||||
go/gmockcook
|
||||
|
||||
You can find recipes for using gMock here. If you haven't yet, please read
|
||||
[the dummy guide](gmock_for_dummies.md) first to make sure you understand the
|
||||
basics.
|
||||
@@ -11,8 +9,6 @@ recommended to write `using ::testing::Foo;` once in your file before using the
|
||||
name `Foo` defined by gMock. We omit such `using` statements in this section for
|
||||
brevity, but you should do it in your own code.
|
||||
|
||||
[TOC]
|
||||
|
||||
## Creating Mock Classes
|
||||
|
||||
Mock classes are defined as normal classes, using the `MOCK_METHOD` macro to
|
||||
@@ -183,8 +179,7 @@ class MockStack : public StackInterface<Elem> {
|
||||
|
||||
### Mocking Non-virtual Methods {#MockingNonVirtualMethods}
|
||||
|
||||
gMock can mock non-virtual functions to be used in Hi-perf dependency
|
||||
injection.[See this](http://go/tott/33)
|
||||
gMock can mock non-virtual functions to be used in Hi-perf dependency injection.
|
||||
|
||||
In this case, instead of sharing a common base class with the real class, your
|
||||
mock class will be *unrelated* to the real class, but contain methods with the
|
||||
@@ -830,7 +825,6 @@ A frequently used matcher is `_`, which matches anything:
|
||||
```cpp
|
||||
EXPECT_CALL(foo, DoThat(_, NotNull()));
|
||||
```
|
||||
<!--#include file="includes/g3_matching_proto_buffers_cookbook_recipe.md"-->
|
||||
|
||||
### Combining Matchers {#CombiningMatchers}
|
||||
|
||||
@@ -1161,8 +1155,6 @@ Note that the predicate function / functor doesn't have to return `bool`. It
|
||||
works as long as the return value can be used as the condition in in statement
|
||||
`if (condition) ...`.
|
||||
|
||||
<!--#include file="includes/g3_callbacks_as_matchers.md"-->
|
||||
|
||||
### Matching Arguments that Are Not Copyable
|
||||
|
||||
When you do an `EXPECT_CALL(mock_obj, Foo(bar))`, gMock saves away a copy of
|
||||
@@ -1478,8 +1470,6 @@ mock object and gMock.
|
||||
|
||||
### Knowing When to Expect {#UseOnCall}
|
||||
|
||||
(go/use-on-call)
|
||||
|
||||
**`ON_CALL`** is likely the *single most under-utilized construct* in gMock.
|
||||
|
||||
There are basically two constructs for defining the behavior of a mock object:
|
||||
@@ -2171,8 +2161,6 @@ own precedence order distinct from the `ON_CALL` precedence order.
|
||||
If the built-in actions don't suit you, you can use an existing callable
|
||||
(function, `std::function`, method, functor, lambda) as an action.
|
||||
|
||||
<!--#include file="includes/g3_callback_snippet.md"-->
|
||||
|
||||
```cpp
|
||||
using ::testing::_; using ::testing::Invoke;
|
||||
|
||||
@@ -3266,8 +3254,6 @@ If you are interested in the mock call trace but not the stack traces, you can
|
||||
combine `--gmock_verbose=info` with `--gtest_stack_trace_depth=0` on the test
|
||||
command line.
|
||||
|
||||
<!--#include file="includes/g3_testing_code_stubby_server.md"-->
|
||||
|
||||
### Running Tests in Emacs
|
||||
|
||||
If you build and run your tests in Emacs using the `M-x google-compile` command
|
||||
@@ -4312,5 +4298,3 @@ expectations.
|
||||
Although `std::function` supports unlimited number of arguments, `MockFunction`
|
||||
implementation is limited to ten. If you ever hit that limit... well, your
|
||||
callback has bigger problems than being mockable. :-)
|
||||
|
||||
<!--#include file="includes/g3_content.md"-->
|
||||
|
||||
Reference in New Issue
Block a user