diff options
author | Timofey <t.danshin@corp.mail.ru> | 2015-12-23 16:31:22 +0300 |
---|---|---|
committer | Timofey <t.danshin@corp.mail.ru> | 2015-12-28 19:17:58 +0300 |
commit | c169f7abc8d25d97299c00637ec66b57ed3374ed (patch) | |
tree | 40a14f6a411f4a0f963088b294f63eb5aa273f7b /testing | |
parent | 8980c2ba961dc393ec8b9ff8c125ba64473e2c57 (diff) |
Added a key for listing all tests in a test suite.
Diffstat (limited to 'testing')
-rw-r--r-- | testing/testing.hpp | 1 | ||||
-rw-r--r-- | testing/testingmain.cpp | 11 |
2 files changed, 12 insertions, 0 deletions
diff --git a/testing/testing.hpp b/testing/testing.hpp index 634e41853e..bb20d53b7e 100644 --- a/testing/testing.hpp +++ b/testing/testing.hpp @@ -42,6 +42,7 @@ struct CommandLineOptions char const * m_resourcePath; bool m_help; + bool m_listTests; }; CommandLineOptions const & GetTestingOptions(); diff --git a/testing/testingmain.cpp b/testing/testingmain.cpp index 7beb89eaa0..6ecb057189 100644 --- a/testing/testingmain.cpp +++ b/testing/testingmain.cpp @@ -39,6 +39,7 @@ char const kSuppressOption[] = "--suppress="; char const kHelpOption[] = "--help"; char const kDataPathOptions[] = "--data_path="; char const kResourcePathOptions[] = "--user_resource_path="; +char const kListAllTestsOption[] = "--list_tests"; enum Status { @@ -69,6 +70,7 @@ void Usage(char const * name) "Do not run tests with names corresponding to regexp."); DisplayOption(cerr, kDataPathOptions, "<Path>", "Path to data files."); DisplayOption(cerr, kResourcePathOptions, "<Path>", "Path to resources, styles and classificators."); + DisplayOption(cerr, kListAllTestsOption, "List all the tests in the test suite and exit."); DisplayOption(cerr, kHelpOption, "Print this help message and exit."); } @@ -87,6 +89,8 @@ void ParseOptions(int argc, char * argv[], CommandLineOptions & options) options.m_resourcePath = arg + sizeof(kResourcePathOptions) - 1; if (strcmp(arg, kHelpOption) == 0) options.m_help = true; + if (strcmp(arg, kListAllTestsOption) == 0) + options.m_listTests = true; } } } // namespace @@ -144,6 +148,13 @@ int main(int argc, char * argv[]) testResults.push_back(true); } + if (GetTestingOptions().m_listTests) + { + for (auto const & name : testNames) + cout << name << endl; + return 0; + } + int iTest = 0; for (TestRegister * pTest = TestRegister::FirstRegister(); pTest; ++iTest, pTest = pTest->m_pNext) { |