aboutsummaryrefslogtreecommitdiffstats
path: root/test/gtest_unittest.cc
diff options
context:
space:
mode:
authorzhanyong.wan <zhanyong.wan@861a406c-534a-0410-8894-cb66d6ee9925>2009-02-02 06:37:03 +0000
committerzhanyong.wan <zhanyong.wan@861a406c-534a-0410-8894-cb66d6ee9925>2009-02-02 06:37:03 +0000
commitad99ca14461f0e929d835d29518e11c05e8d41f0 (patch)
tree9d78a31a14ff899d38bbf15f328b44c7c28d0caa /test/gtest_unittest.cc
parent4b83461e9772cce62e84310060fe84172e9bf4ba (diff)
downloadgoogletest-ad99ca14461f0e929d835d29518e11c05e8d41f0.tar.gz
googletest-ad99ca14461f0e929d835d29518e11c05e8d41f0.tar.bz2
googletest-ad99ca14461f0e929d835d29518e11c05e8d41f0.zip
Exposes gtest flags to user code access. By Alexander Demin.
Diffstat (limited to 'test/gtest_unittest.cc')
-rw-r--r--test/gtest_unittest.cc19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/gtest_unittest.cc b/test/gtest_unittest.cc
index cf9163be..847502c7 100644
--- a/test/gtest_unittest.cc
+++ b/test/gtest_unittest.cc
@@ -33,6 +33,25 @@
// Google Test work.
#include <gtest/gtest.h>
+
+// Verifies that the command line flag variables can be accessed
+// in code once <gtest/gtest.h> has been #included.
+// Do not move it after other #includes.
+TEST(CommandLineFlagsTest, CanBeAccessedInCodeOnceGTestHIsIncluded) {
+ bool dummy = testing::GTEST_FLAG(also_run_disabled_tests)
+ || testing::GTEST_FLAG(break_on_failure)
+ || testing::GTEST_FLAG(catch_exceptions)
+ || testing::GTEST_FLAG(color) != "unknown"
+ || testing::GTEST_FLAG(filter) != "unknown"
+ || testing::GTEST_FLAG(list_tests)
+ || testing::GTEST_FLAG(output) != "unknown"
+ || testing::GTEST_FLAG(print_time)
+ || testing::GTEST_FLAG(repeat) > 0
+ || testing::GTEST_FLAG(show_internal_stack_frames)
+ || testing::GTEST_FLAG(stack_trace_depth) > 0;
+ EXPECT_TRUE(dummy || !dummy); // Suppresses warning that dummy is unused.
+}
+
#include <gtest/gtest-spi.h>
// Indicates that this translation unit is part of Google Test's