diff --git a/src/gtest.cc b/src/gtest.cc index 5903f2ae..b77f62e7 100644 --- a/src/gtest.cc +++ b/src/gtest.cc @@ -211,7 +211,7 @@ GTEST_DEFINE_string_( GTEST_DEFINE_bool_( print_time, - internal::BoolFromGTestEnv("print_time", false), + internal::BoolFromGTestEnv("print_time", true), "True iff " GTEST_NAME_ " should display elapsed time in text output."); @@ -4141,8 +4141,8 @@ static const char kColorEncodedHelpMessage[] = "Test Output:\n" " @G--" GTEST_FLAG_PREFIX_ "color=@Y(@Gyes@Y|@Gno@Y|@Gauto@Y)@D\n" " Enable/disable colored output. The default is @Gauto@D.\n" -" -@G-" GTEST_FLAG_PREFIX_ "print_time@D\n" -" Print the elapsed time of each test.\n" +" -@G-" GTEST_FLAG_PREFIX_ "print_time=0@D\n" +" Don't print the elapsed time of each test.\n" " @G--" GTEST_FLAG_PREFIX_ "output=xml@Y[@G:@YDIRECTORY_PATH@G" GTEST_PATH_SEP_ "@Y|@G:@YFILE_PATH]@D\n" " Generate an XML report in the given directory or with the given file\n" @@ -4165,10 +4165,9 @@ static const char kColorEncodedHelpMessage[] = "Except for @G--" GTEST_FLAG_PREFIX_ "list_tests@D, you can alternatively set " "the corresponding\n" "environment variable of a flag (all letters in upper-case). For example, to\n" -"print the elapsed time, you can either specify @G--" GTEST_FLAG_PREFIX_ - "print_time@D or set the\n" -"@G" GTEST_FLAG_PREFIX_UPPER_ "PRINT_TIME@D environment variable to a " - "non-zero value.\n" +"disable colored text output, you can either specify @G--" GTEST_FLAG_PREFIX_ + "color=no@D or set\n" +"the @G" GTEST_FLAG_PREFIX_UPPER_ "COLOR@D environment variable to @Gno@D.\n" "\n" "For more information, please read the " GTEST_NAME_ " documentation at\n" "@G" GTEST_PROJECT_URL_ "@D. If you find a bug in " GTEST_NAME_ "\n" diff --git a/test/gtest_env_var_test.py b/test/gtest_env_var_test.py index 92b9cd8a..35e8041f 100755 --- a/test/gtest_env_var_test.py +++ b/test/gtest_env_var_test.py @@ -90,7 +90,7 @@ def TestEnvVarAffectsFlag(command): TestFlag(command, 'color', 'yes', 'auto') TestFlag(command, 'filter', 'FooTest.Bar', '*') TestFlag(command, 'output', 'tmp/foo.xml', '') - TestFlag(command, 'print_time', '1', '0') + TestFlag(command, 'print_time', '0', '1') TestFlag(command, 'repeat', '999', '1') TestFlag(command, 'throw_on_failure', '1', '0') TestFlag(command, 'death_test_style', 'threadsafe', 'fast') diff --git a/test/gtest_output_test_.cc b/test/gtest_output_test_.cc index a47560be..4d7f0758 100644 --- a/test/gtest_output_test_.cc +++ b/test/gtest_output_test_.cc @@ -976,6 +976,8 @@ GTEST_DEFINE_bool_(internal_skip_environment_and_ad_hoc_tests, false, // of them are intended to fail), and then compare the test results // with the "golden" file. int main(int argc, char **argv) { + testing::GTEST_FLAG(print_time) = false; + // We just run the tests, knowing some of them are intended to fail. // We will use a separate Python script to compare the output of // this program with the golden file. diff --git a/test/gtest_unittest.cc b/test/gtest_unittest.cc index d1c517b5..0786725b 100644 --- a/test/gtest_unittest.cc +++ b/test/gtest_unittest.cc @@ -1204,7 +1204,7 @@ class GTestFlagSaverTest : public Test { GTEST_FLAG(filter) = ""; GTEST_FLAG(list_tests) = false; GTEST_FLAG(output) = ""; - GTEST_FLAG(print_time) = false; + GTEST_FLAG(print_time) = true; GTEST_FLAG(repeat) = 1; GTEST_FLAG(throw_on_failure) = false; } @@ -1227,7 +1227,7 @@ class GTestFlagSaverTest : public Test { EXPECT_STREQ("", GTEST_FLAG(filter).c_str()); EXPECT_FALSE(GTEST_FLAG(list_tests)); EXPECT_STREQ("", GTEST_FLAG(output).c_str()); - EXPECT_FALSE(GTEST_FLAG(print_time)); + EXPECT_TRUE(GTEST_FLAG(print_time)); EXPECT_EQ(1, GTEST_FLAG(repeat)); EXPECT_FALSE(GTEST_FLAG(throw_on_failure)); @@ -1239,7 +1239,7 @@ class GTestFlagSaverTest : public Test { GTEST_FLAG(filter) = "abc"; GTEST_FLAG(list_tests) = true; GTEST_FLAG(output) = "xml:foo.xml"; - GTEST_FLAG(print_time) = true; + GTEST_FLAG(print_time) = false; GTEST_FLAG(repeat) = 100; GTEST_FLAG(throw_on_failure) = true; } @@ -4325,7 +4325,7 @@ struct Flags { filter(""), list_tests(false), output(""), - print_time(false), + print_time(true), repeat(1), throw_on_failure(false) {} @@ -4436,7 +4436,7 @@ class InitGoogleTestTest : public Test { GTEST_FLAG(filter) = ""; GTEST_FLAG(list_tests) = false; GTEST_FLAG(output) = ""; - GTEST_FLAG(print_time) = false; + GTEST_FLAG(print_time) = true; GTEST_FLAG(repeat) = 1; GTEST_FLAG(throw_on_failure) = false; }