MCPcopy Create free account
hub / github.com/catchorg/Catch2 / defaultListTests

Function defaultListTests

extras/catch_amalgamated.cpp:10482–10520  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10480 }
10481
10482 void defaultListTests(std::ostream& out, ColourImpl* streamColour, std::vector<TestCaseHandle> const& tests, bool isFiltered, Verbosity verbosity) {
10483 // We special case this to provide the equivalent of old
10484 // `--list-test-names-only`, which could then be used by the
10485 // `--input-file` option.
10486 if (verbosity == Verbosity::Quiet) {
10487 listTestNamesOnly(out, tests);
10488 return;
10489 }
10490
10491 if (isFiltered) {
10492 out << "Matching test cases:\n";
10493 } else {
10494 out << "All available test cases:\n";
10495 }
10496
10497 for (auto const& test : tests) {
10498 auto const& testCaseInfo = test.getTestCaseInfo();
10499 Colour::Code colour = testCaseInfo.isHidden()
10500 ? Colour::SecondaryText
10501 : Colour::None;
10502 auto colourGuard = streamColour->guardColour( colour ).engage( out );
10503
10504 out << TextFlow::Column(testCaseInfo.name).indent(2) << '\n';
10505 if (verbosity >= Verbosity::High) {
10506 out << TextFlow::Column(Catch::Detail::stringify(testCaseInfo.lineInfo)).indent(4) << '\n';
10507 }
10508 if (!testCaseInfo.tags.empty() &&
10509 verbosity > Verbosity::Quiet) {
10510 out << TextFlow::Column(testCaseInfo.tagsAsString()).indent(6) << '\n';
10511 }
10512 }
10513
10514 if (isFiltered) {
10515 out << pluralise(tests.size(), "matching test case"_sr);
10516 } else {
10517 out << pluralise(tests.size(), "test case"_sr);
10518 }
10519 out << "\n\n" << std::flush;
10520 }
10521
10522 namespace {
10523 class SummaryColumn {

Callers 2

listTestsMethod · 0.70

Calls 11

listTestNamesOnlyFunction · 0.70
ColumnClass · 0.70
stringifyFunction · 0.70
pluraliseClass · 0.70
isHiddenMethod · 0.45
engageMethod · 0.45
guardColourMethod · 0.45
indentMethod · 0.45
emptyMethod · 0.45
tagsAsStringMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected