From ad99ca14461f0e929d835d29518e11c05e8d41f0 Mon Sep 17 00:00:00 2001 From: "zhanyong.wan" Date: Mon, 2 Feb 2009 06:37:03 +0000 Subject: Exposes gtest flags to user code access. By Alexander Demin. --- test/gtest_unittest.cc | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'test/gtest_unittest.cc') 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 + +// Verifies that the command line flag variables can be accessed +// in code once 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 // Indicates that this translation unit is part of Google Test's -- cgit v1.2.3