mirror of
https://github.com/google/googletest.git
synced 2024-12-26 17:41:03 +08:00
Googletest export
Code style cleanup in docs PiperOrigin-RevId: 364907938
This commit is contained in:
parent
5142ccd2d4
commit
6dabd081e9
@ -1205,10 +1205,10 @@ class FooTest : public testing::Test {
|
||||
}
|
||||
|
||||
// You can define per-test set-up logic as usual.
|
||||
virtual void SetUp() { ... }
|
||||
void SetUp() override { ... }
|
||||
|
||||
// You can define per-test tear-down logic as usual.
|
||||
virtual void TearDown() { ... }
|
||||
void TearDown() override { ... }
|
||||
|
||||
// Some expensive resource shared by all tests.
|
||||
static T* shared_resource_;
|
||||
@ -1239,7 +1239,7 @@ First, you subclass the `::testing::Environment` class to define a test
|
||||
environment, which knows how to set-up and tear-down:
|
||||
|
||||
```c++
|
||||
class Environment : public testing::Environment {
|
||||
class Environment : public ::testing::Environment {
|
||||
public:
|
||||
~Environment() override {}
|
||||
|
||||
@ -1974,13 +1974,13 @@ Here's an example:
|
||||
```c++
|
||||
class MinimalistPrinter : public testing::EmptyTestEventListener {
|
||||
// Called before a test starts.
|
||||
virtual void OnTestStart(const testing::TestInfo& test_info) {
|
||||
void OnTestStart(const testing::TestInfo& test_info) override {
|
||||
printf("*** Test %s.%s starting.\n",
|
||||
test_info.test_suite_name(), test_info.name());
|
||||
}
|
||||
|
||||
// Called after a failed assertion or a SUCCESS().
|
||||
virtual void OnTestPartResult(const testing::TestPartResult& test_part_result) {
|
||||
void OnTestPartResult(const testing::TestPartResult& test_part_result) override {
|
||||
printf("%s in %s:%d\n%s\n",
|
||||
test_part_result.failed() ? "*** Failure" : "Success",
|
||||
test_part_result.file_name(),
|
||||
@ -1989,7 +1989,7 @@ Here's an example:
|
||||
}
|
||||
|
||||
// Called after a test ends.
|
||||
virtual void OnTestEnd(const testing::TestInfo& test_info) {
|
||||
void OnTestEnd(const testing::TestInfo& test_info) override {
|
||||
printf("*** Test %s.%s ending.\n",
|
||||
test_info.test_suite_name(), test_info.name());
|
||||
}
|
||||
|
@ -268,7 +268,7 @@ class FileInterface {
|
||||
class File : public FileInterface {
|
||||
public:
|
||||
...
|
||||
virtual bool Open(const char* path, const char* mode) {
|
||||
bool Open(const char* path, const char* mode) override {
|
||||
return OpenFile(path, mode);
|
||||
}
|
||||
};
|
||||
@ -512,9 +512,9 @@ The trick is to redispatch the method in the mock class:
|
||||
class ScopedMockLog : public LogSink {
|
||||
public:
|
||||
...
|
||||
virtual void send(LogSeverity severity, const char* full_filename,
|
||||
void send(LogSeverity severity, const char* full_filename,
|
||||
const char* base_filename, int line, const tm* tm_time,
|
||||
const char* message, size_t message_len) {
|
||||
const char* message, size_t message_len) override {
|
||||
// We are only interested in the log severity, full file name, and
|
||||
// log message.
|
||||
Log(severity, full_filename, std::string(message, message_len));
|
||||
|
Loading…
x
Reference in New Issue
Block a user