| 11255 | namespace Catch { |
| 11256 | |
| 11257 | std::size_t listTests( Config const& config ) { |
| 11258 | TestSpec const& testSpec = config.testSpec(); |
| 11259 | if( config.hasTestFilters() ) |
| 11260 | Catch::cout() << "Matching test cases:\n"; |
| 11261 | else { |
| 11262 | Catch::cout() << "All available test cases:\n"; |
| 11263 | } |
| 11264 | |
| 11265 | auto matchedTestCases = filterTests( getAllTestCasesSorted( config ), testSpec, config ); |
| 11266 | for( auto const& testCaseInfo : matchedTestCases ) { |
| 11267 | Colour::Code colour = testCaseInfo.isHidden() |
| 11268 | ? Colour::SecondaryText |
| 11269 | : Colour::None; |
| 11270 | Colour colourGuard( colour ); |
| 11271 | |
| 11272 | Catch::cout() << Column( testCaseInfo.name ).initialIndent( 2 ).indent( 4 ) << "\n"; |
| 11273 | if( config.verbosity() >= Verbosity::High ) { |
| 11274 | Catch::cout() << Column( Catch::Detail::stringify( testCaseInfo.lineInfo ) ).indent(4) << std::endl; |
| 11275 | std::string description = testCaseInfo.description; |
| 11276 | if( description.empty() ) |
| 11277 | description = "(NO DESCRIPTION)"; |
| 11278 | Catch::cout() << Column( description ).indent(4) << std::endl; |
| 11279 | } |
| 11280 | if( !testCaseInfo.tags.empty() ) |
| 11281 | Catch::cout() << Column( testCaseInfo.tagsAsString() ).indent( 6 ) << "\n"; |
| 11282 | } |
| 11283 | |
| 11284 | if( !config.hasTestFilters() ) |
| 11285 | Catch::cout() << pluralise( matchedTestCases.size(), "test case" ) << '\n' << std::endl; |
| 11286 | else |
| 11287 | Catch::cout() << pluralise( matchedTestCases.size(), "matching test case" ) << '\n' << std::endl; |
| 11288 | return matchedTestCases.size(); |
| 11289 | } |
| 11290 | |
| 11291 | std::size_t listTestsNamesOnly( Config const& config ) { |
| 11292 | TestSpec const& testSpec = config.testSpec(); |
no test coverage detected