aboutsummaryrefslogtreecommitdiffstats
path: root/googletest/docs
diff options
context:
space:
mode:
authorAbseil Team <absl-team@google.com>2019-10-28 14:09:47 -0400
committervslashg <gfalcon@google.com>2019-10-29 16:51:40 -0400
commit2bee6da24e9f63a22a4ed0f87e3db8583401fc68 (patch)
tree0afef7f51d87c1229538e136bba4e248d72aefc5 /googletest/docs
parent755f853c6be9ff44d6125367fa5ebdb75c382640 (diff)
downloadgoogletest-2bee6da24e9f63a22a4ed0f87e3db8583401fc68.tar.gz
googletest-2bee6da24e9f63a22a4ed0f87e3db8583401fc68.tar.bz2
googletest-2bee6da24e9f63a22a4ed0f87e3db8583401fc68.zip
Googletest export
Editorial cleanup of the "write the main function" section PiperOrigin-RevId: 277102507
Diffstat (limited to 'googletest/docs')
-rw-r--r--googletest/docs/primer.md16
1 files changed, 11 insertions, 5 deletions
diff --git a/googletest/docs/primer.md b/googletest/docs/primer.md
index 51394024..63f05168 100644
--- a/googletest/docs/primer.md
+++ b/googletest/docs/primer.md
@@ -491,15 +491,18 @@ You can start from this boilerplate:
```c++
#include "this/package/foo.h"
+
#include "gtest/gtest.h"
+namespace my {
+namespace project {
namespace {
// The fixture for testing class Foo.
class FooTest : public ::testing::Test {
protected:
- // You can remove any or all of the following functions if its body
- // is empty.
+ // You can remove any or all of the following functions if their bodies would
+ // be empty.
FooTest() {
// You can do set-up work for each test here.
@@ -522,7 +525,8 @@ class FooTest : public ::testing::Test {
// before the destructor).
}
- // Objects declared here can be used by all tests in the test suite for Foo.
+ // Class members declared here can be used by all tests in the test suite
+ // for Foo.
};
// Tests that the Foo::Bar() method does Abc.
@@ -539,6 +543,8 @@ TEST_F(FooTest, DoesXyz) {
}
} // namespace
+} // namespace project
+} // namespace my
int main(int argc, char **argv) {
::testing::InitGoogleTest(&argc, argv);
@@ -555,10 +561,10 @@ the [AdvancedGuide](advanced.md). You **must** call this function before calling
On Windows, `InitGoogleTest()` also works with wide strings, so it can be used
in programs compiled in `UNICODE` mode as well.
-But maybe you think that writing all those main() functions is too much work? We
+But maybe you think that writing all those `main` functions is too much work? We
agree with you completely, and that's why Google Test provides a basic
implementation of main(). If it fits your needs, then just link your test with
-gtest\_main library and you are good to go.
+the `gtest_main` library and you are good to go.
NOTE: `ParseGUnitFlags()` is deprecated in favor of `InitGoogleTest()`.