mirror of
https://github.com/catchorg/Catch2.git
synced 2024-11-17 19:22:25 +01:00
--list-test-names-and-sources Fixed tabs/spaces
This commit is contained in:
parent
8fd23466ba
commit
d0bd13dc17
@ -174,9 +174,9 @@ namespace Catch {
|
|||||||
.bind( &ConfigData::filenamesAsTags );
|
.bind( &ConfigData::filenamesAsTags );
|
||||||
|
|
||||||
// Less common commands which don't have a short form
|
// Less common commands which don't have a short form
|
||||||
cli["--list-test-names-and-sources"]
|
cli["--list-test-names-and-sources"]
|
||||||
.describe("list all/matching test cases names along with their source files")
|
.describe("list all/matching test cases names along with their source files")
|
||||||
.bind(&ConfigData::listTestNamesAndSources);
|
.bind(&ConfigData::listTestNamesAndSources);
|
||||||
|
|
||||||
cli["--list-test-names-only"]
|
cli["--list-test-names-only"]
|
||||||
.describe( "list all/matching test cases names only" )
|
.describe( "list all/matching test cases names only" )
|
||||||
|
@ -31,7 +31,7 @@ namespace Catch {
|
|||||||
: listTests( false ),
|
: listTests( false ),
|
||||||
listTags( false ),
|
listTags( false ),
|
||||||
listReporters( false ),
|
listReporters( false ),
|
||||||
listTestNamesAndSources( false ),
|
listTestNamesAndSources( false ),
|
||||||
listTestNamesOnly( false ),
|
listTestNamesOnly( false ),
|
||||||
showSuccessfulTests( false ),
|
showSuccessfulTests( false ),
|
||||||
shouldDebugBreak( false ),
|
shouldDebugBreak( false ),
|
||||||
@ -51,8 +51,8 @@ namespace Catch {
|
|||||||
bool listTests;
|
bool listTests;
|
||||||
bool listTags;
|
bool listTags;
|
||||||
bool listReporters;
|
bool listReporters;
|
||||||
bool listTestNamesAndSources;
|
bool listTestNamesAndSources;
|
||||||
bool listTestNamesOnly;
|
bool listTestNamesOnly;
|
||||||
|
|
||||||
bool showSuccessfulTests;
|
bool showSuccessfulTests;
|
||||||
bool shouldDebugBreak;
|
bool shouldDebugBreak;
|
||||||
@ -109,7 +109,7 @@ namespace Catch {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool listTests() const { return m_data.listTests; }
|
bool listTests() const { return m_data.listTests; }
|
||||||
bool listTestNamesAndSources() const { return m_data.listTestNamesAndSources; }
|
bool listTestNamesAndSources() const { return m_data.listTestNamesAndSources; }
|
||||||
bool listTestNamesOnly() const { return m_data.listTestNamesOnly; }
|
bool listTestNamesOnly() const { return m_data.listTestNamesOnly; }
|
||||||
bool listTags() const { return m_data.listTags; }
|
bool listTags() const { return m_data.listTags; }
|
||||||
bool listReporters() const { return m_data.listReporters; }
|
bool listReporters() const { return m_data.listReporters; }
|
||||||
|
@ -57,23 +57,23 @@ namespace Catch {
|
|||||||
return matchedTests;
|
return matchedTests;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline std::size_t listTestsNames( Config const& config , const bool includeSources ) {
|
inline std::size_t listTestsNames( Config const& config , const bool includeSources ) {
|
||||||
TestSpec testSpec = config.testSpec();
|
TestSpec testSpec = config.testSpec();
|
||||||
if( !config.testSpec().hasFilters() )
|
if( !config.testSpec().hasFilters() )
|
||||||
testSpec = TestSpecParser( ITagAliasRegistry::get() ).parse( "*" ).testSpec();
|
testSpec = TestSpecParser( ITagAliasRegistry::get() ).parse( "*" ).testSpec();
|
||||||
std::size_t matchedTests = 0;
|
std::size_t matchedTests = 0;
|
||||||
std::vector<TestCase> matchedTestCases = filterTests( getAllTestCasesSorted( config ), testSpec, config );
|
std::vector<TestCase> matchedTestCases = filterTests( getAllTestCasesSorted( config ), testSpec, config );
|
||||||
for( std::vector<TestCase>::const_iterator it = matchedTestCases.begin(), itEnd = matchedTestCases.end();
|
for( std::vector<TestCase>::const_iterator it = matchedTestCases.begin(), itEnd = matchedTestCases.end();
|
||||||
it != itEnd;
|
it != itEnd;
|
||||||
++it ) {
|
++it ) {
|
||||||
matchedTests++;
|
matchedTests++;
|
||||||
TestCaseInfo const& testCaseInfo = it->getTestCaseInfo();
|
TestCaseInfo const& testCaseInfo = it->getTestCaseInfo();
|
||||||
Catch::cout() << testCaseInfo.name << std::endl;
|
Catch::cout() << testCaseInfo.name << std::endl;
|
||||||
if( includeSources )
|
if( includeSources )
|
||||||
Catch::cout() << testCaseInfo.lineInfo << std::endl;
|
Catch::cout() << testCaseInfo.lineInfo << std::endl;
|
||||||
}
|
}
|
||||||
return matchedTests;
|
return matchedTests;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct TagInfo {
|
struct TagInfo {
|
||||||
TagInfo() : count ( 0 ) {}
|
TagInfo() : count ( 0 ) {}
|
||||||
@ -164,10 +164,10 @@ namespace Catch {
|
|||||||
Option<std::size_t> listedCount;
|
Option<std::size_t> listedCount;
|
||||||
if( config.listTests() )
|
if( config.listTests() )
|
||||||
listedCount = listedCount.valueOr(0) + listTests( config );
|
listedCount = listedCount.valueOr(0) + listTests( config );
|
||||||
|
if( config.listTestNamesAndSources() )
|
||||||
|
listedCount = listedCount.valueOr(0) + listTestsNames(config, true);
|
||||||
if( config.listTestNamesOnly() )
|
if( config.listTestNamesOnly() )
|
||||||
listedCount = listedCount.valueOr(0) + listTestsNames( config , false );
|
listedCount = listedCount.valueOr(0) + listTestsNames( config , false );
|
||||||
if( config.listTestNamesAndSources() )
|
|
||||||
listedCount = listedCount.valueOr(0) + listTestsNames( config , true );
|
|
||||||
if( config.listTags() )
|
if( config.listTags() )
|
||||||
listedCount = listedCount.valueOr(0) + listTags( config );
|
listedCount = listedCount.valueOr(0) + listTags( config );
|
||||||
if( config.listReporters() )
|
if( config.listReporters() )
|
||||||
|
Loading…
Reference in New Issue
Block a user