Reverts original commit. No longer needed with new approach

This commit is contained in:
David Schuldenfrei 2018-07-12 14:06:03 +03:00
parent d3c2871992
commit 3dda876e91
3 changed files with 6 additions and 34 deletions

View File

@ -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);

View File

@ -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_; }

View File

@ -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,10 +5299,6 @@ 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());
if (test_info->value_param() != NULL) {
printf(" # %s = ", kValueParamLabel);
@ -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,
&GTEST_FLAG(internal_run_death_test)) ||
ParseBoolFlag(arg, kListTestsFlag, &GTEST_FLAG(list_tests)) ||
ParseBoolFlag(arg, kListTestsWithLocationFlag,
&GTEST_FLAG(list_tests_with_location)) ||
ParseStringFlag(arg, kOutputFlag, &GTEST_FLAG(output)) ||
ParseBoolFlag(arg, kPrintTimeFlag, &GTEST_FLAG(print_time)) ||
ParseBoolFlag(arg, kPrintUTF8Flag, &GTEST_FLAG(print_utf8)) ||