| 10832 | namespace Catch { |
| 10833 | |
| 10834 | std::size_t listTests( Config const& config ) { |
| 10835 | TestSpec testSpec = config.testSpec(); |
| 10836 | if( config.hasTestFilters() ) |
| 10837 | Catch::cout() << "Matching test cases:\n"; |
| 10838 | else { |
| 10839 | Catch::cout() << "All available test cases:\n"; |
| 10840 | } |
| 10841 | |
| 10842 | auto matchedTestCases = filterTests( getAllTestCasesSorted( config ), testSpec, config ); |
| 10843 | for( auto const& testCaseInfo : matchedTestCases ) { |
| 10844 | Colour::Code colour = testCaseInfo.isHidden() |
| 10845 | ? Colour::SecondaryText |
| 10846 | : Colour::None; |
| 10847 | Colour colourGuard( colour ); |
| 10848 | |
| 10849 | Catch::cout() << Column( testCaseInfo.name ).initialIndent( 2 ).indent( 4 ) << "\n"; |
| 10850 | if( config.verbosity() >= Verbosity::High ) { |
| 10851 | Catch::cout() << Column( Catch::Detail::stringify( testCaseInfo.lineInfo ) ).indent(4) << std::endl; |
| 10852 | std::string description = testCaseInfo.description; |
| 10853 | if( description.empty() ) |
| 10854 | description = "(NO DESCRIPTION)"; |
| 10855 | Catch::cout() << Column( description ).indent(4) << std::endl; |
| 10856 | } |
| 10857 | if( !testCaseInfo.tags.empty() ) |
| 10858 | Catch::cout() << Column( testCaseInfo.tagsAsString() ).indent( 6 ) << "\n"; |
| 10859 | } |
| 10860 | |
| 10861 | if( !config.hasTestFilters() ) |
| 10862 | Catch::cout() << pluralise( matchedTestCases.size(), "test case" ) << '\n' << std::endl; |
| 10863 | else |
| 10864 | Catch::cout() << pluralise( matchedTestCases.size(), "matching test case" ) << '\n' << std::endl; |
| 10865 | return matchedTestCases.size(); |
| 10866 | } |
| 10867 | |
| 10868 | std::size_t listTestsNamesOnly( Config const& config ) { |
| 10869 | TestSpec testSpec = config.testSpec(); |
no test coverage detected