aboutsummaryrefslogtreecommitdiff
path: root/googletest/test/gtest_environment_test.cc
diff options
context:
space:
mode:
Diffstat (limited to 'googletest/test/gtest_environment_test.cc')
-rw-r--r--googletest/test/gtest_environment_test.cc23
1 files changed, 7 insertions, 16 deletions
diff --git a/googletest/test/gtest_environment_test.cc b/googletest/test/gtest_environment_test.cc
index 064bfc50..122eaf3c 100644
--- a/googletest/test/gtest_environment_test.cc
+++ b/googletest/test/gtest_environment_test.cc
@@ -30,20 +30,15 @@
//
// Tests using global test environments.
-#include <stdlib.h>
#include <stdio.h>
+#include <stdlib.h>
+
#include "gtest/gtest.h"
#include "src/gtest-internal-inl.h"
-namespace testing {
-GTEST_DECLARE_string_(filter);
-}
-
namespace {
-enum FailureType {
- NO_FAILURE, NON_FATAL_FAILURE, FATAL_FAILURE
-};
+enum FailureType { NO_FAILURE, NON_FATAL_FAILURE, FATAL_FAILURE };
// For testing using global test environments.
class MyEnvironment : public testing::Environment {
@@ -83,9 +78,7 @@ class MyEnvironment : public testing::Environment {
// We call this function to set the type of failure SetUp() should
// generate.
- void set_failure_in_set_up(FailureType type) {
- failure_in_set_up_ = type;
- }
+ void set_failure_in_set_up(FailureType type) { failure_in_set_up_ = type; }
// Was SetUp() run?
bool set_up_was_run() const { return set_up_was_run_; }
@@ -104,9 +97,7 @@ bool test_was_run;
// The sole purpose of this TEST is to enable us to check whether it
// was run.
-TEST(FooTest, Bar) {
- test_was_run = true;
-}
+TEST(FooTest, Bar) { test_was_run = true; }
// Prints the message and aborts the program if condition is false.
void Check(bool condition, const char* msg) {
@@ -130,7 +121,7 @@ int RunAllTests(MyEnvironment* env, FailureType failure) {
} // namespace
-int main(int argc, char **argv) {
+int main(int argc, char** argv) {
testing::InitGoogleTest(&argc, argv);
// Registers a global test environment, and verifies that the
@@ -174,7 +165,7 @@ int main(int argc, char **argv) {
// Verifies that RUN_ALL_TESTS() doesn't do global set-up or
// tear-down when there is no test to run.
- testing::GTEST_FLAG(filter) = "-*";
+ GTEST_FLAG_SET(filter, "-*");
Check(RunAllTests(env, NO_FAILURE) == 0,
"RUN_ALL_TESTS() should return zero, as there is no test to run.");
Check(!env->set_up_was_run(),