mirror of
https://github.com/catchorg/Catch2.git
synced 2025-09-14 17:35:39 +02:00
Added ability to load names of tests to run from a file
- use -f to specify filename. Blank lines and lines starting with # are ignored - also added --list-test-names-only to list test names out to file in a form that can be immediate read in by -f
This commit is contained in:
@@ -60,6 +60,20 @@ namespace Catch {
|
||||
return matchedTests;
|
||||
}
|
||||
|
||||
inline std::size_t listTestsNamesOnly( Config const& config ) {
|
||||
std::size_t matchedTests = 0;
|
||||
std::vector<TestCase> const& allTests = getRegistryHub().getTestCaseRegistry().getAllTests();
|
||||
for( std::vector<TestCase>::const_iterator it = allTests.begin(), itEnd = allTests.end();
|
||||
it != itEnd;
|
||||
++it )
|
||||
if( matchesFilters( config.filters(), *it ) ) {
|
||||
matchedTests++;
|
||||
TestCaseInfo const& testCaseInfo = it->getTestCaseInfo();
|
||||
std::cout << testCaseInfo.name << std::endl;
|
||||
}
|
||||
return matchedTests;
|
||||
}
|
||||
|
||||
inline std::size_t listTags( Config const& config ) {
|
||||
if( config.filters().empty() )
|
||||
std::cout << "All available tags:\n";
|
||||
@@ -131,6 +145,8 @@ namespace Catch {
|
||||
Option<std::size_t> listedCount;
|
||||
if( config.listTests() )
|
||||
listedCount = listedCount.valueOr(0) + listTests( config );
|
||||
if( config.listTestNamesOnly() )
|
||||
listedCount = listedCount.valueOr(0) + listTestsNamesOnly( config );
|
||||
if( config.listTags() )
|
||||
listedCount = listedCount.valueOr(0) + listTags( config );
|
||||
if( config.listReporters() )
|
||||
|
Reference in New Issue
Block a user