Skip to content

Commit 6dabd08

Browse files
Abseil Teamdinord
authored andcommitted
Googletest export
Code style cleanup in docs PiperOrigin-RevId: 364907938
1 parent 5142ccd commit 6dabd08

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

docs/advanced.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1205,10 +1205,10 @@ class FooTest : public testing::Test {
12051205
}
12061206

12071207
// You can define per-test set-up logic as usual.
1208-
virtual void SetUp() { ... }
1208+
void SetUp() override { ... }
12091209

12101210
// You can define per-test tear-down logic as usual.
1211-
virtual void TearDown() { ... }
1211+
void TearDown() override { ... }
12121212

12131213
// Some expensive resource shared by all tests.
12141214
static T* shared_resource_;
@@ -1239,7 +1239,7 @@ First, you subclass the `::testing::Environment` class to define a test
12391239
environment, which knows how to set-up and tear-down:
12401240
12411241
```c++
1242-
class Environment : public testing::Environment {
1242+
class Environment : public ::testing::Environment {
12431243
public:
12441244
~Environment() override {}
12451245
@@ -1974,13 +1974,13 @@ Here's an example:
19741974
```c++
19751975
class MinimalistPrinter : public testing::EmptyTestEventListener {
19761976
// Called before a test starts.
1977-
virtual void OnTestStart(const testing::TestInfo& test_info) {
1977+
void OnTestStart(const testing::TestInfo& test_info) override {
19781978
printf("*** Test %s.%s starting.\n",
19791979
test_info.test_suite_name(), test_info.name());
19801980
}
19811981
19821982
// Called after a failed assertion or a SUCCESS().
1983-
virtual void OnTestPartResult(const testing::TestPartResult& test_part_result) {
1983+
void OnTestPartResult(const testing::TestPartResult& test_part_result) override {
19841984
printf("%s in %s:%d\n%s\n",
19851985
test_part_result.failed() ? "*** Failure" : "Success",
19861986
test_part_result.file_name(),
@@ -1989,7 +1989,7 @@ Here's an example:
19891989
}
19901990
19911991
// Called after a test ends.
1992-
virtual void OnTestEnd(const testing::TestInfo& test_info) {
1992+
void OnTestEnd(const testing::TestInfo& test_info) override {
19931993
printf("*** Test %s.%s ending.\n",
19941994
test_info.test_suite_name(), test_info.name());
19951995
}

docs/gmock_cook_book.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ class FileInterface {
268268
class File : public FileInterface {
269269
public:
270270
...
271-
virtual bool Open(const char* path, const char* mode) {
271+
bool Open(const char* path, const char* mode) override {
272272
return OpenFile(path, mode);
273273
}
274274
};
@@ -512,9 +512,9 @@ The trick is to redispatch the method in the mock class:
512512
class ScopedMockLog : public LogSink {
513513
public:
514514
...
515-
virtual void send(LogSeverity severity, const char* full_filename,
515+
void send(LogSeverity severity, const char* full_filename,
516516
const char* base_filename, int line, const tm* tm_time,
517-
const char* message, size_t message_len) {
517+
const char* message, size_t message_len) override {
518518
// We are only interested in the log severity, full file name, and
519519
// log message.
520520
Log(severity, full_filename, std::string(message, message_len));

0 commit comments

Comments
 (0)