Skip to content

Commit 4892835

Browse files
Abseil Teamderekmauro
Abseil Team
authored andcommitted
Googletest export
Move all docs into top-level docs/ directory PiperOrigin-RevId: 350211277
1 parent 996b65e commit 4892835

35 files changed

+48
-2905
lines changed

googletest/docs/advanced.md renamed to docs/advanced.md

+7-7
Original file line numberDiff line numberDiff line change
@@ -371,8 +371,8 @@ Verifies that `val1` is less than, or almost equal to, `val2`. You can replace
371371
372372
### Asserting Using gMock Matchers
373373
374-
[gMock](../../googlemock) comes with
375-
[a library of matchers](../../googlemock/docs/cheat_sheet.md#MatcherList) for
374+
[gMock](gmock_index.md) comes with
375+
[a library of matchers](gmock_cheat_sheet.md#MatcherList) for
376376
validating arguments passed to mock objects. A gMock *matcher* is basically a
377377
predicate that knows how to describe itself. It can be used in these assertion
378378
macros:
@@ -396,13 +396,13 @@ using ::testing::StartsWith;
396396
```
397397

398398
Read this
399-
[recipe](../../googlemock/docs/cook_book.md#using-matchers-in-googletest-assertions)
399+
[recipe](gmock_cook_book.md#using-matchers-in-googletest-assertions)
400400
in the gMock Cookbook for more details.
401401

402402
gMock has a rich set of matchers. You can do many things googletest cannot do
403403
alone with them. For a list of matchers gMock provides, read
404-
[this](../../googlemock/docs/cook_book.md##using-matchers). It's easy to write
405-
your [own matchers](../../googlemock/docs/cook_book.md#NewMatchers) too.
404+
[this](gmock_cook_book.md##using-matchers). It's easy to write
405+
your [own matchers](gmock_cook_book.md#NewMatchers) too.
406406

407407
gMock is bundled with googletest, so you don't need to add any build dependency
408408
in order to take advantage of this. Just include `"gmock/gmock.h"`
@@ -414,7 +414,7 @@ and you're ready to go.
414414
you haven't.)
415415

416416
You can use the gMock
417-
[string matchers](../../googlemock/docs/cheat_sheet.md#string-matchers) with
417+
[string matchers](gmock_cheat_sheet.md#string-matchers) with
418418
`EXPECT_THAT()` or `ASSERT_THAT()` to do more string comparison tricks
419419
(sub-string, prefix, suffix, regular expression, and etc). For example,
420420

@@ -915,7 +915,7 @@ handlers registered with `pthread_atfork(3)`.
915915
916916
Note: If you want to put a series of test assertions in a subroutine to check
917917
for a complex condition, consider using
918-
[a custom GMock matcher](../../googlemock/docs/cook_book.md#NewMatchers)
918+
[a custom GMock matcher](gmock_cook_book.md#NewMatchers)
919919
instead. This lets you provide a more readable error message in case of failure
920920
and avoid all of the issues described below.
921921
File renamed without changes.

googlemock/docs/cheat_sheet.md renamed to docs/gmock_cheat_sheet.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ Example usage:
179179
To customize the default action for a particular method of a specific mock
180180
object, use `ON_CALL()`. `ON_CALL()` has a similar syntax to `EXPECT_CALL()`,
181181
but it is used for setting default behaviors (when you do not require that the
182-
mock method is called). See [here](cook_book.md#UseOnCall) for a more detailed
182+
mock method is called). See [here](gmock_cook_book.md#UseOnCall) for a more detailed
183183
discussion.
184184
185185
```cpp
@@ -477,7 +477,7 @@ You can make a matcher from one or more other matchers:
477477
| Matcher | Description |
478478
| :---------------------- | :------------------------------------ |
479479
| `MatcherCast<T>(m)` | casts matcher `m` to type `Matcher<T>`. |
480-
| `SafeMatcherCast<T>(m)` | [safely casts](cook_book.md#casting-matchers) matcher `m` to type `Matcher<T>`. |
480+
| `SafeMatcherCast<T>(m)` | [safely casts](gmock_cook_book.md#casting-matchers) matcher `m` to type `Matcher<T>`. |
481481
| `Truly(predicate)` | `predicate(argument)` returns something considered by C++ to be true, where `predicate` is a function or functor. |
482482
<!-- mdformat on -->
483483
@@ -774,7 +774,7 @@ class MockFunction<R(A1, ..., An)> {
774774
};
775775
```
776776
777-
See this [recipe](cook_book.md#using-check-points) for one application of it.
777+
See this [recipe](gmock_cook_book.md#using-check-points) for one application of it.
778778
779779
## Flags
780780

googlemock/docs/cook_book.md renamed to docs/gmock_cook_book.md

+10-9
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
<!-- GOOGLETEST_CM0012 DO NOT DELETE -->
44

55
You can find recipes for using gMock here. If you haven't yet, please read
6-
[the dummy guide](for_dummies.md) first to make sure you understand the basics.
6+
[the dummy guide](gmock_for_dummies.md) first to make sure you understand the
7+
basics.
78

89
**Note:** gMock lives in the `testing` name space. For readability, it is
910
recommended to write `using ::testing::Foo;` once in your file before using the
@@ -1141,11 +1142,11 @@ Hamcrest project, which adds `assertThat()` to JUnit.
11411142

11421143
### Using Predicates as Matchers
11431144

1144-
gMock provides a [built-in set](cheat_sheet.md#MatcherList) of matchers. In case
1145-
you find them lacking, you can use an arbitrary unary predicate function or
1146-
functor as a matcher - as long as the predicate accepts a value of the type you
1147-
want. You do this by wrapping the predicate inside the `Truly()` function, for
1148-
example:
1145+
gMock provides a [built-in set](gmock_cheat_sheet.md#MatcherList) of matchers.
1146+
In case you find them lacking, you can use an arbitrary unary predicate function
1147+
or functor as a matcher - as long as the predicate accepts a value of the type
1148+
you want. You do this by wrapping the predicate inside the `Truly()` function,
1149+
for example:
11491150

11501151
```cpp
11511152
using ::testing::Truly;
@@ -1710,7 +1711,7 @@ the test should reflect our real intent, instead of being overly constraining.
17101711

17111712
gMock allows you to impose an arbitrary DAG (directed acyclic graph) on the
17121713
calls. One way to express the DAG is to use the
1713-
[After](cheat_sheet.md#AfterClause) clause of `EXPECT_CALL`.
1714+
[After](gmock_cheat_sheet.md#AfterClause) clause of `EXPECT_CALL`.
17141715

17151716
Another way is via the `InSequence()` clause (not the same as the `InSequence`
17161717
class), which we borrowed from jMock 2. It's less flexible than `After()`, but
@@ -3714,8 +3715,8 @@ A cardinality is used in `Times()` to tell gMock how many times you expect a
37143715
call to occur. It doesn't have to be exact. For example, you can say
37153716
`AtLeast(5)` or `Between(2, 4)`.
37163717

3717-
If the [built-in set](cheat_sheet.md#CardinalityList) of cardinalities doesn't
3718-
suit you, you are free to define your own by implementing the following
3718+
If the [built-in set](gmock_cheat_sheet.md#CardinalityList) of cardinalities
3719+
doesn't suit you, you are free to define your own by implementing the following
37193720
interface (in namespace `testing`):
37203721

37213722
```cpp

googlemock/docs/gmock_faq.md renamed to docs/gmock_faq.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
### When I call a method on my mock object, the method for the real object is invoked instead. What's the problem?
88

99
In order for a method to be mocked, it must be *virtual*, unless you use the
10-
[high-perf dependency injection technique](cook_book.md#MockingNonVirtualMethods).
10+
[high-perf dependency injection technique](gmock_cook_book.md#MockingNonVirtualMethods).
1111

1212
### Can I mock a variadic function?
1313

@@ -93,9 +93,9 @@ trace, you'll gain insights on why the expectations you set are not met.
9393

9494
If you see the message "The mock function has no default action set, and its
9595
return type has no default value set.", then try
96-
[adding a default action](for_dummies.md#DefaultValue). Due to a known issue,
97-
unexpected calls on mocks without default actions don't print out a detailed
98-
comparison between the actual arguments and the expected arguments.
96+
[adding a default action](gmock_for_dummies.md#DefaultValue). Due to a known
97+
issue, unexpected calls on mocks without default actions don't print out a
98+
detailed comparison between the actual arguments and the expected arguments.
9999

100100
### My program crashed and `ScopedMockLog` spit out tons of messages. Is it a gMock bug?
101101

@@ -388,8 +388,8 @@ doesn't say what the return value should be. You need `DoAll()` to chain a
388388
`SetArgPointee()` with a `Return()` that provides a value appropriate to the API
389389
being mocked.
390390

391-
See this [recipe](cook_book.md#mocking-side-effects) for more details and an
392-
example.
391+
See this [recipe](gmock_cook_book.md#mocking-side-effects) for more details and
392+
an example.
393393

394394
### I have a huge mock class, and Microsoft Visual C++ runs out of memory when compiling it. What can I do?
395395

googlemock/docs/for_dummies.md renamed to docs/gmock_for_dummies.md

+9-9
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ follow:
150150
151151
* Derive a class `MockTurtle` from `Turtle`.
152152
* Take a *virtual* function of `Turtle` (while it's possible to
153-
[mock non-virtual methods using templates](cook_book.md#MockingNonVirtualMethods),
153+
[mock non-virtual methods using templates](gmock_cook_book.md#MockingNonVirtualMethods),
154154
it's much more involved).
155155
* In the `public:` section of the child class, write `MOCK_METHOD();`
156156
* Now comes the fun part: you take the function signature, cut-and-paste it
@@ -376,8 +376,8 @@ convenient way of saying "any value".
376376
In the above examples, `100` and `50` are also matchers; implicitly, they are
377377
the same as `Eq(100)` and `Eq(50)`, which specify that the argument must be
378378
equal (using `operator==`) to the matcher argument. There are many
379-
[built-in matchers](cheat_sheet.md#MatcherList) for common types (as well as
380-
[custom matchers](cook_book.md#NewMatchers)); for example:
379+
[built-in matchers](gmock_cheat_sheet.md#MatcherList) for common types (as well
380+
as [custom matchers](gmock_cook_book.md#NewMatchers)); for example:
381381
382382
```cpp
383383
using ::testing::Ge;
@@ -399,7 +399,7 @@ EXPECT_CALL(turtle, GoTo);
399399
This works for all non-overloaded methods; if a method is overloaded, you need
400400
to help gMock resolve which overload is expected by specifying the number of
401401
arguments and possibly also the
402-
[types of the arguments](cook_book.md#SelectOverload).
402+
[types of the arguments](gmock_cook_book.md#SelectOverload).
403403
404404
### Cardinalities: How Many Times Will It Be Called?
405405
@@ -416,7 +416,7 @@ called.
416416
417417
We've seen `AtLeast(n)` as an example of fuzzy cardinalities earlier. For the
418418
list of built-in cardinalities you can use, see
419-
[here](cheat_sheet.md#CardinalityList).
419+
[here](gmock_cheat_sheet.md#CardinalityList).
420420
421421
The `Times()` clause can be omitted. **If you omit `Times()`, gMock will infer
422422
the cardinality for you.** The rules are easy to remember:
@@ -485,7 +485,7 @@ the *default* action for the function every time (unless, of course, you have a
485485
486486
What can we do inside `WillOnce()` besides `Return()`? You can return a
487487
reference using `ReturnRef(*variable*)`, or invoke a pre-defined function, among
488-
[others](cook_book.md#using-actions).
488+
[others](gmock_cook_book.md#using-actions).
489489
490490
**Important note:** The `EXPECT_CALL()` statement evaluates the action clause
491491
only once, even though the action may be performed many times. Therefore you
@@ -563,7 +563,7 @@ overloaded). This makes any calls to the method expected. This is not necessary
563563
for methods that are not mentioned at all (these are "uninteresting"), but is
564564
useful for methods that have some expectations, but for which other calls are
565565
ok. See
566-
[Understanding Uninteresting vs Unexpected Calls](cook_book.md#uninteresting-vs-unexpected).
566+
[Understanding Uninteresting vs Unexpected Calls](gmock_cook_book.md#uninteresting-vs-unexpected).
567567

568568
### Ordered vs Unordered Calls {#OrderedCalls}
569569

@@ -600,7 +600,7 @@ order as written. If a call is made out-of-order, it will be an error.
600600
601601
(What if you care about the relative order of some of the calls, but not all of
602602
them? Can you specify an arbitrary partial order? The answer is ... yes! The
603-
details can be found [here](cook_book.md#OrderedCalls).)
603+
details can be found [here](gmock_cook_book.md#OrderedCalls).)
604604
605605
### All Expectations Are Sticky (Unless Said Otherwise) {#StickyExpectations}
606606
@@ -699,4 +699,4 @@ For example, in some tests we may not care about how many times `GetX()` and
699699
In gMock, if you are not interested in a method, just don't say anything about
700700
it. If a call to this method occurs, you'll see a warning in the test output,
701701
but it won't be a failure. This is called "naggy" behavior; to change, see
702-
[The Nice, the Strict, and the Naggy](cook_book.md#NiceStrictNaggy).
702+
[The Nice, the Strict, and the Naggy](gmock_cook_book.md#NiceStrictNaggy).
File renamed without changes.
File renamed without changes.

googlemock/docs/pump_manual.md renamed to docs/pump_manual.md

+5-4
Original file line numberDiff line numberDiff line change
@@ -166,10 +166,11 @@ exp ::= simple_expression_in_Python_syntax
166166
167167
## Code
168168
169-
You can find the source code of Pump in [scripts/pump.py](../scripts/pump.py).
170-
It is still very unpolished and lacks automated tests, although it has been
171-
successfully used many times. If you find a chance to use it in your project,
172-
please let us know what you think! We also welcome help on improving Pump.
169+
You can find the source code of Pump in
170+
[googlemock/scripts/pump.py](../googlemock/scripts/pump.py). It is still very
171+
unpolished and lacks automated tests, although it has been successfully used
172+
many times. If you find a chance to use it in your project, please let us know
173+
what you think! We also welcome help on improving Pump.
173174
174175
## Real Examples
175176
File renamed without changes.

googlemock/docs/README.md

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Content Moved
2+
3+
We are working on updates to the GoogleTest documentation, which has moved to
4+
the top-level [docs](../../docs) directory.

googlemock/docs/contribute.md

-5
This file was deleted.

0 commit comments

Comments
 (0)