MCPcopy Create free account
hub / github.com/ChaiScript/ChaiScript / listTests

Function listTests

unittests/catch.hpp:7731–7763  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7729namespace 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();

Callers 1

listFunction · 0.85

Calls 13

filterTestsFunction · 0.85
ColumnClass · 0.85
stringifyFunction · 0.85
pluraliseClass · 0.85
testSpecMethod · 0.80
hasTestFiltersMethod · 0.80
isHiddenMethod · 0.80
initialIndentMethod · 0.80
verbosityMethod · 0.80
tagsAsStringMethod · 0.80
indentMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected