summaryrefslogtreecommitdiffstats
path: root/googletest/docs/primer.md
diff options
context:
space:
mode:
authorGennadiy Civil <misterg@google.com>2019-06-24 17:52:17 (GMT)
committerGennadiy Civil <misterg@google.com>2019-06-24 17:52:17 (GMT)
commit437e1008c97b6bf595fec85da42c6925babd96b2 (patch)
treea3c21753bf440ceeb63ef0907be5d0beacc4bff2 /googletest/docs/primer.md
parent834dff3b5279164c65f13cc712ed79dbb5c66950 (diff)
downloadgoogletest-437e1008c97b6bf595fec85da42c6925babd96b2.zip
googletest-437e1008c97b6bf595fec85da42c6925babd96b2.tar.gz
googletest-437e1008c97b6bf595fec85da42c6925babd96b2.tar.bz2
Documentation sync in preparation to including docs with full source sync
Diffstat (limited to 'googletest/docs/primer.md')
-rw-r--r--googletest/docs/primer.md26
1 files changed, 12 insertions, 14 deletions
diff --git a/googletest/docs/primer.md b/googletest/docs/primer.md
index 2b33030..ba17ce8 100644
--- a/googletest/docs/primer.md
+++ b/googletest/docs/primer.md
@@ -193,8 +193,7 @@ objects, you should use `ASSERT_EQ`.
When doing pointer comparisons use `*_EQ(ptr, nullptr)` and `*_NE(ptr, nullptr)`
instead of `*_EQ(ptr, NULL)` and `*_NE(ptr, NULL)`. This is because `nullptr` is
-typed while `NULL` is not. See [FAQ](faq.md#why-does-googletest-support-expect_eqnull-ptr-and-assert_eqnull-ptr-but-not-expect_nenull-ptr-and-assert_nenull-ptr)
-for more details.
+typed while `NULL` is not. See [FAQ](faq.md)for more details.
If you're working with floating point numbers, you may want to use the floating
point variations of some of these macros in order to avoid problems caused by
@@ -295,8 +294,8 @@ should be in the same test suite; in other words, the first argument to their
suite `FactorialTest`.
When naming your test suites and tests, you should follow the same convention as
-for [naming functions and
-classes](https://google.github.io/styleguide/cppguide.html#Function_Names).
+for
+[naming functions and classes](https://google.github.io/styleguide/cppguide.html#Function_Names).
**Availability**: Linux, Windows, Mac.
@@ -318,7 +317,7 @@ To create a fixture:
1. If necessary, write a destructor or `TearDown()` function to release any
resources you allocated in `SetUp()` . To learn when you should use the
constructor/destructor and when you should use `SetUp()/TearDown()`, read
- this [FAQ](faq.md#should-i-use-the-constructordestructor-of-the-test-fixture-or-setupteardown) entry.
+ the [FAQ](faq.md).
1. If needed, define subroutines for your tests to share.
When using a fixture, use `TEST_F()` instead of `TEST()` as it allows you to
@@ -432,7 +431,6 @@ When these tests run, the following happens:
**Availability**: Linux, Windows, Mac.
-
## Invoking the Tests
`TEST()` and `TEST_F()` implicitly register their tests with googletest. So,
@@ -446,7 +444,7 @@ different test suites, or even different source files.
When invoked, the `RUN_ALL_TESTS()` macro:
-1. Saves the state of all googletest flags
+* Saves the state of all googletest flags
* Creates a test fixture object for the first test.
@@ -458,7 +456,7 @@ When invoked, the `RUN_ALL_TESTS()` macro:
* Deletes the fixture.
-* Restores the state of all googletest flags
+* Restores the state of all all googletest flags
* Repeats the above steps for the next test, until all tests have run.
@@ -471,15 +469,17 @@ If a fatal failure happens the subsequent steps will be skipped.
> return the value of `RUN_ALL_TESTS()`.
>
> Also, you should call `RUN_ALL_TESTS()` only **once**. Calling it more than
-> once conflicts with some advanced googletest features (e.g. thread-safe [death
-> tests](advanced.md#death-tests)) and thus is not supported.
+> once conflicts with some advanced googletest features (e.g. thread-safe
+> [death tests](advanced.md#death-tests)) and thus is not supported.
**Availability**: Linux, Windows, Mac.
## Writing the main() Function
-Write your own main() function, which should
-return the value of `RUN_ALL_TESTS()`
+Write your own main() function, which should return the value of
+`RUN_ALL_TESTS()`
+
+You can start from this boilerplate:
```c++
#include "this/package/foo.h"
@@ -538,7 +538,6 @@ int main(int argc, char **argv) {
}
```
-
The `::testing::InitGoogleTest()` function parses the command line for
googletest flags, and removes all recognized flags. This allows the user to
control a test program's behavior via various flags, which we'll cover in
@@ -555,7 +554,6 @@ gtest\_main library and you are good to go.
NOTE: `ParseGUnitFlags()` is deprecated in favor of `InitGoogleTest()`.
-
## Known Limitations
* Google Test is designed to be thread-safe. The implementation is thread-safe