From 3dda876e91d53ed41ee88cde8b566835c45ec72d Mon Sep 17 00:00:00 2001 From: David Schuldenfrei Date: Thu, 12 Jul 2018 14:06:03 +0300 Subject: [PATCH] Reverts original commit. No longer needed with new approach --- googletest/include/gtest/gtest.h | 5 ----- googletest/src/gtest-internal-inl.h | 6 +----- googletest/src/gtest.cc | 29 +++++------------------------ 3 files changed, 6 insertions(+), 34 deletions(-) diff --git a/googletest/include/gtest/gtest.h b/googletest/include/gtest/gtest.h index debb26cf..686750e0 100644 --- a/googletest/include/gtest/gtest.h +++ b/googletest/include/gtest/gtest.h @@ -116,11 +116,6 @@ GTEST_DECLARE_string_(filter); // are actually run if the flag is provided. GTEST_DECLARE_bool_(list_tests); -// This flag causes the Google Test to list tests with their location -// (file and line number). None of the tests listed -// are actually run if the flag is provided. -GTEST_DECLARE_bool_(list_tests_with_location); - // This flag controls whether Google Test emits a detailed XML report to a file // in addition to its normal textual output. GTEST_DECLARE_string_(output); diff --git a/googletest/src/gtest-internal-inl.h b/googletest/src/gtest-internal-inl.h index 8a014351..e77c8b6c 100644 --- a/googletest/src/gtest-internal-inl.h +++ b/googletest/src/gtest-internal-inl.h @@ -84,7 +84,6 @@ const char kCatchExceptionsFlag[] = "catch_exceptions"; const char kColorFlag[] = "color"; const char kFilterFlag[] = "filter"; const char kListTestsFlag[] = "list_tests"; -const char kListTestsWithLocationFlag[] = "list_tests_with_location"; const char kOutputFlag[] = "output"; const char kPrintTimeFlag[] = "print_time"; const char kPrintUTF8Flag[] = "print_utf8"; @@ -166,7 +165,6 @@ class GTestFlagSaver { filter_ = GTEST_FLAG(filter); internal_run_death_test_ = GTEST_FLAG(internal_run_death_test); list_tests_ = GTEST_FLAG(list_tests); - list_tests_with_location_ = GTEST_FLAG(list_tests_with_location); output_ = GTEST_FLAG(output); print_time_ = GTEST_FLAG(print_time); print_utf8_ = GTEST_FLAG(print_utf8); @@ -189,7 +187,6 @@ class GTestFlagSaver { GTEST_FLAG(filter) = filter_; GTEST_FLAG(internal_run_death_test) = internal_run_death_test_; GTEST_FLAG(list_tests) = list_tests_; - GTEST_FLAG(list_tests_with_location) = list_tests_with_location_; GTEST_FLAG(output) = output_; GTEST_FLAG(print_time) = print_time_; GTEST_FLAG(print_utf8) = print_utf8_; @@ -212,7 +209,6 @@ class GTestFlagSaver { std::string filter_; std::string internal_run_death_test_; bool list_tests_; - bool list_tests_with_location_; std::string output_; bool print_time_; bool print_utf8_; @@ -726,7 +722,7 @@ class GTEST_API_ UnitTestImpl { int FilterTests(ReactionToSharding shard_tests); // Prints the names of the tests matching the user-specified filter flag. - void ListTestsMatchingFilter(bool list_location); + void ListTestsMatchingFilter(); const TestCase* current_test_case() const { return current_test_case_; } TestInfo* current_test_info() { return current_test_info_; } diff --git a/googletest/src/gtest.cc b/googletest/src/gtest.cc index 53c7398f..ce6c07fa 100644 --- a/googletest/src/gtest.cc +++ b/googletest/src/gtest.cc @@ -231,9 +231,6 @@ GTEST_DEFINE_string_( GTEST_DEFINE_bool_(list_tests, false, "List all tests without running them."); -GTEST_DEFINE_bool_(list_tests_with_location, false, - "List all tests, and their location, without running them."); - // The net priority order after flag processing is thus: // --gtest_output command line flag // GTEST_OUTPUT environment variable @@ -4997,15 +4994,9 @@ bool UnitTestImpl::RunAllTests() { // Lists the tests and exits if the --gtest_list_tests flag was specified. if (GTEST_FLAG(list_tests)) { // This must be called *after* FilterTests() has been called. - ListTestsMatchingFilter(false); + ListTestsMatchingFilter(); return true; } - if (GTEST_FLAG(list_tests_with_location)) { - // This must be called *after* FilterTests() has been called. - ListTestsMatchingFilter(true); - return true; - } - random_seed_ = GTEST_FLAG(shuffle) ? GetRandomSeedFromFlag(GTEST_FLAG(random_seed)) : 0; @@ -5285,7 +5276,7 @@ static void PrintOnOneLine(const char* str, int max_length) { } // Prints the names of the tests matching the user-specified filter flag. -void UnitTestImpl::ListTestsMatchingFilter(bool list_location) { +void UnitTestImpl::ListTestsMatchingFilter() { // Print at most this many characters for each type/value parameter. const int kMaxParamLength = 250; @@ -5308,11 +5299,7 @@ void UnitTestImpl::ListTestsMatchingFilter(bool list_location) { } printf("\n"); } - printf(" "); - if (list_location) { - printf("%d;%s;", test_info->line(), test_info->file()); - } - printf("%s", test_info->name()); + printf(" %s", test_info->name()); if (test_info->value_param() != NULL) { printf(" # %s = ", kValueParamLabel); // We print the value parameter on a single line to make the @@ -5595,9 +5582,6 @@ static const char kColorEncodedHelpMessage[] = " @G--" GTEST_FLAG_PREFIX_ "list_tests@D\n" " List the names of all tests instead of running them. The name of\n" " TEST(Foo, Bar) is \"Foo.Bar\".\n" -" @G--" GTEST_FLAG_PREFIX_ "list_tests_with_location@D\n" -" List the names of all tests, and their location instead of running them. The name of\n" -" TEST(Foo, Bar) is \"Foo.Bar\", and the lcation is lineNumber;fileName.\n" " @G--" GTEST_FLAG_PREFIX_ "filter=@YPOSTIVE_PATTERNS" "[@G-@YNEGATIVE_PATTERNS]@D\n" " Run only the tests whose name matches one of the positive patterns but\n" @@ -5643,9 +5627,8 @@ static const char kColorEncodedHelpMessage[] = " Do not report exceptions as test failures. Instead, allow them\n" " to crash the program or throw a pop-up (on Windows).\n" "\n" -"Except for @G--" GTEST_FLAG_PREFIX_ "list_tests@D, and " - "@G--" GTEST_FLAG_PREFIX_ "list_tests_with_location@D " - "you can alternatively set the corresponding\n" +"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" "disable colored text output, you can either specify @G--" GTEST_FLAG_PREFIX_ "color=no@D or set\n" @@ -5672,8 +5655,6 @@ static bool ParseGoogleTestFlag(const char* const arg) { ParseStringFlag(arg, kInternalRunDeathTestFlag, >EST_FLAG(internal_run_death_test)) || ParseBoolFlag(arg, kListTestsFlag, >EST_FLAG(list_tests)) || - ParseBoolFlag(arg, kListTestsWithLocationFlag, - >EST_FLAG(list_tests_with_location)) || ParseStringFlag(arg, kOutputFlag, >EST_FLAG(output)) || ParseBoolFlag(arg, kPrintTimeFlag, >EST_FLAG(print_time)) || ParseBoolFlag(arg, kPrintUTF8Flag, >EST_FLAG(print_utf8)) ||