| 7729 | namespace Catch { |
| 7730 | |
| 7731 | std::size_t listTests( Config const& config ) { |
| 7732 | TestSpec testSpec = config.testSpec(); |
| 7733 | if( config.hasTestFilters() ) |
| 7734 | Catch::cout() << "Matching test cases:\n"; |
| 7735 | else { |
| 7736 | Catch::cout() << "All available test cases:\n"; |
| 7737 | } |
| 7738 | |
| 7739 | auto matchedTestCases = filterTests( getAllTestCasesSorted( config ), testSpec, config ); |
| 7740 | for( auto const& testCaseInfo : matchedTestCases ) { |
| 7741 | Colour::Code colour = testCaseInfo.isHidden() |
| 7742 | ? Colour::SecondaryText |
| 7743 | : Colour::None; |
| 7744 | Colour colourGuard( colour ); |
| 7745 | |
| 7746 | Catch::cout() << Column( testCaseInfo.name ).initialIndent( 2 ).indent( 4 ) << "\n"; |
| 7747 | if( config.verbosity() >= Verbosity::High ) { |
| 7748 | Catch::cout() << Column( Catch::Detail::stringify( testCaseInfo.lineInfo ) ).indent(4) << std::endl; |
| 7749 | std::string description = testCaseInfo.description; |
| 7750 | if( description.empty() ) |
| 7751 | description = "(NO DESCRIPTION)"; |
| 7752 | Catch::cout() << Column( description ).indent(4) << std::endl; |
| 7753 | } |
| 7754 | if( !testCaseInfo.tags.empty() ) |
| 7755 | Catch::cout() << Column( testCaseInfo.tagsAsString() ).indent( 6 ) << "\n"; |
| 7756 | } |
| 7757 | |
| 7758 | if( !config.hasTestFilters() ) |
| 7759 | Catch::cout() << pluralise( matchedTestCases.size(), "test case" ) << '\n' << std::endl; |
| 7760 | else |
| 7761 | Catch::cout() << pluralise( matchedTestCases.size(), "matching test case" ) << '\n' << std::endl; |
| 7762 | return matchedTestCases.size(); |
| 7763 | } |
| 7764 | |
| 7765 | std::size_t listTestsNamesOnly( Config const& config ) { |
| 7766 | TestSpec testSpec = config.testSpec(); |
no test coverage detected