diff --git a/include/internal/catch_commandline.hpp b/include/internal/catch_commandline.hpp index dff8d75d..978cf078 100644 --- a/include/internal/catch_commandline.hpp +++ b/include/internal/catch_commandline.hpp @@ -174,9 +174,9 @@ namespace Catch { .bind( &ConfigData::filenamesAsTags ); // Less common commands which don't have a short form - cli["--list-test-names-and-sources"] - .describe("list all/matching test cases names along with their source files") - .bind(&ConfigData::listTestNamesAndSources); + cli["--list-test-names-and-sources"] + .describe("list all/matching test cases names along with their source files") + .bind(&ConfigData::listTestNamesAndSources); cli["--list-test-names-only"] .describe( "list all/matching test cases names only" ) diff --git a/include/internal/catch_config.hpp b/include/internal/catch_config.hpp index 94daf65f..39d406b2 100644 --- a/include/internal/catch_config.hpp +++ b/include/internal/catch_config.hpp @@ -31,7 +31,7 @@ namespace Catch { : listTests( false ), listTags( false ), listReporters( false ), - listTestNamesAndSources( false ), + listTestNamesAndSources( false ), listTestNamesOnly( false ), showSuccessfulTests( false ), shouldDebugBreak( false ), @@ -51,8 +51,8 @@ namespace Catch { bool listTests; bool listTags; bool listReporters; - bool listTestNamesAndSources; - bool listTestNamesOnly; + bool listTestNamesAndSources; + bool listTestNamesOnly; bool showSuccessfulTests; bool shouldDebugBreak; @@ -109,7 +109,7 @@ namespace Catch { } 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 listTags() const { return m_data.listTags; } bool listReporters() const { return m_data.listReporters; } diff --git a/include/internal/catch_list.hpp b/include/internal/catch_list.hpp index b56b3f4c..e2d36e3b 100644 --- a/include/internal/catch_list.hpp +++ b/include/internal/catch_list.hpp @@ -57,23 +57,23 @@ namespace Catch { return matchedTests; } - inline std::size_t listTestsNames( Config const& config , const bool includeSources ) { - TestSpec testSpec = config.testSpec(); - if( !config.testSpec().hasFilters() ) - testSpec = TestSpecParser( ITagAliasRegistry::get() ).parse( "*" ).testSpec(); - std::size_t matchedTests = 0; - std::vector matchedTestCases = filterTests( getAllTestCasesSorted( config ), testSpec, config ); - for( std::vector::const_iterator it = matchedTestCases.begin(), itEnd = matchedTestCases.end(); - it != itEnd; - ++it ) { - matchedTests++; - TestCaseInfo const& testCaseInfo = it->getTestCaseInfo(); - Catch::cout() << testCaseInfo.name << std::endl; - if( includeSources ) - Catch::cout() << testCaseInfo.lineInfo << std::endl; - } - return matchedTests; - } + inline std::size_t listTestsNames( Config const& config , const bool includeSources ) { + TestSpec testSpec = config.testSpec(); + if( !config.testSpec().hasFilters() ) + testSpec = TestSpecParser( ITagAliasRegistry::get() ).parse( "*" ).testSpec(); + std::size_t matchedTests = 0; + std::vector matchedTestCases = filterTests( getAllTestCasesSorted( config ), testSpec, config ); + for( std::vector::const_iterator it = matchedTestCases.begin(), itEnd = matchedTestCases.end(); + it != itEnd; + ++it ) { + matchedTests++; + TestCaseInfo const& testCaseInfo = it->getTestCaseInfo(); + Catch::cout() << testCaseInfo.name << std::endl; + if( includeSources ) + Catch::cout() << testCaseInfo.lineInfo << std::endl; + } + return matchedTests; + } struct TagInfo { TagInfo() : count ( 0 ) {} @@ -164,10 +164,10 @@ namespace Catch { Option listedCount; if( config.listTests() ) listedCount = listedCount.valueOr(0) + listTests( config ); + if( config.listTestNamesAndSources() ) + listedCount = listedCount.valueOr(0) + listTestsNames(config, true); if( config.listTestNamesOnly() ) listedCount = listedCount.valueOr(0) + listTestsNames( config , false ); - if( config.listTestNamesAndSources() ) - listedCount = listedCount.valueOr(0) + listTestsNames( config , true ); if( config.listTags() ) listedCount = listedCount.valueOr(0) + listTags( config ); if( config.listReporters() )