| 8900 | namespace Catch { |
| 8901 | |
| 8902 | std::size_t listTests( Config const& config ) { |
| 8903 | TestSpec testSpec = config.testSpec(); |
| 8904 | if( config.hasTestFilters() ) |
| 8905 | Catch::cout() << "Matching test cases:\n"; |
| 8906 | else { |
| 8907 | Catch::cout() << "All available test cases:\n"; |
| 8908 | } |
| 8909 | |
| 8910 | auto matchedTestCases = filterTests( getAllTestCasesSorted( config ), testSpec, config ); |
| 8911 | for( auto const& testCaseInfo : matchedTestCases ) { |
| 8912 | Colour::Code colour = testCaseInfo.isHidden() |
| 8913 | ? Colour::SecondaryText |
| 8914 | : Colour::None; |
| 8915 | Colour colourGuard( colour ); |
| 8916 | |
| 8917 | Catch::cout() << Column( testCaseInfo.name ).initialIndent( 2 ).indent( 4 ) << "\n"; |
| 8918 | if( config.verbosity() >= Verbosity::High ) { |
| 8919 | Catch::cout() << Column( Catch::Detail::stringify( testCaseInfo.lineInfo ) ).indent(4) << std::endl; |
| 8920 | std::string description = testCaseInfo.description; |
| 8921 | if( description.empty() ) |
| 8922 | description = "(NO DESCRIPTION)"; |
| 8923 | Catch::cout() << Column( description ).indent(4) << std::endl; |
| 8924 | } |
| 8925 | if( !testCaseInfo.tags.empty() ) |
| 8926 | Catch::cout() << Column( testCaseInfo.tagsAsString() ).indent( 6 ) << "\n"; |
| 8927 | } |
| 8928 | |
| 8929 | if( !config.hasTestFilters() ) |
| 8930 | Catch::cout() << pluralise( matchedTestCases.size(), "test case" ) << '\n' << std::endl; |
| 8931 | else |
| 8932 | Catch::cout() << pluralise( matchedTestCases.size(), "matching test case" ) << '\n' << std::endl; |
| 8933 | return matchedTestCases.size(); |
| 8934 | } |
| 8935 | |
| 8936 | std::size_t listTestsNamesOnly( Config const& config ) { |
| 8937 | TestSpec testSpec = config.testSpec(); |
no test coverage detected