| 7524 | namespace Catch { |
| 7525 | |
| 7526 | std::size_t listTests(Config const &config) { |
| 7527 | TestSpec testSpec = config.testSpec(); |
| 7528 | if (config.hasTestFilters()) |
| 7529 | Catch::cout() << "Matching test cases:\n"; |
| 7530 | else { |
| 7531 | Catch::cout() << "All available test cases:\n"; |
| 7532 | } |
| 7533 | |
| 7534 | auto matchedTestCases = filterTests(getAllTestCasesSorted(config), testSpec, config); |
| 7535 | for (auto const &testCaseInfo : matchedTestCases) { |
| 7536 | Colour::Code colour = testCaseInfo.isHidden() ? Colour::SecondaryText : Colour::None; |
| 7537 | Colour colourGuard(colour); |
| 7538 | |
| 7539 | Catch::cout() << Column(testCaseInfo.name).initialIndent(2).indent(4) << "\n"; |
| 7540 | if (config.verbosity() >= Verbosity::High) { |
| 7541 | Catch::cout() << Column(Catch::Detail::stringify(testCaseInfo.lineInfo)).indent(4) << std::endl; |
| 7542 | std::string description = testCaseInfo.description; |
| 7543 | if (description.empty()) |
| 7544 | description = "(NO DESCRIPTION)"; |
| 7545 | Catch::cout() << Column(description).indent(4) << std::endl; |
| 7546 | } |
| 7547 | if (!testCaseInfo.tags.empty()) |
| 7548 | Catch::cout() << Column(testCaseInfo.tagsAsString()).indent(6) << "\n"; |
| 7549 | } |
| 7550 | |
| 7551 | if (!config.hasTestFilters()) |
| 7552 | Catch::cout() << pluralise(matchedTestCases.size(), "test case") << '\n' << std::endl; |
| 7553 | else |
| 7554 | Catch::cout() << pluralise(matchedTestCases.size(), "matching test case") << '\n' << std::endl; |
| 7555 | return matchedTestCases.size(); |
| 7556 | } |
| 7557 | |
| 7558 | std::size_t listTestsNamesOnly(Config const &config) { |
| 7559 | TestSpec testSpec = config.testSpec(); |
no test coverage detected