mirror of
https://github.com/catchorg/Catch2.git
synced 2024-12-22 19:33:29 +01:00
Avoid adding a default test spec when none was provided
This commit is contained in:
parent
b9dd1936e5
commit
e99f1efd28
@ -16,10 +16,7 @@ namespace Catch {
|
||||
m_stream( openStream() )
|
||||
{
|
||||
TestSpecParser parser(ITagAliasRegistry::get());
|
||||
if (data.testsOrTags.empty()) {
|
||||
parser.parse("~[.]"); // All not hidden tests
|
||||
}
|
||||
else {
|
||||
if (!data.testsOrTags.empty()) {
|
||||
m_hasTestFilters = true;
|
||||
for( auto const& testOrTags : data.testsOrTags )
|
||||
parser.parse( testOrTags );
|
||||
|
@ -72,7 +72,10 @@ namespace Catch {
|
||||
|
||||
auto const& allTestCases = getAllTestCasesSorted(*config);
|
||||
for (auto const& testCase : allTestCases) {
|
||||
if (!context.aborting() && matchTest(testCase, testSpec, *config))
|
||||
bool matching = (!testSpec.hasFilters() && !testCase.isHidden()) ||
|
||||
(testSpec.hasFilters() && matchTest(testCase, testSpec, *config));
|
||||
|
||||
if (!context.aborting() && matching)
|
||||
totals += context.runTest(testCase);
|
||||
else
|
||||
context.reporter().skipTest(testCase);
|
||||
|
@ -54,9 +54,12 @@ namespace Catch {
|
||||
std::vector<TestCase> filterTests( std::vector<TestCase> const& testCases, TestSpec const& testSpec, IConfig const& config ) {
|
||||
std::vector<TestCase> filtered;
|
||||
filtered.reserve( testCases.size() );
|
||||
for( auto const& testCase : testCases )
|
||||
if( matchTest( testCase, testSpec, config ) )
|
||||
filtered.push_back( testCase );
|
||||
for (auto const& testCase : testCases) {
|
||||
if ((!testSpec.hasFilters() && !testCase.isHidden()) ||
|
||||
(testSpec.hasFilters() && matchTest(testCase, testSpec, config))) {
|
||||
filtered.push_back(testCase);
|
||||
}
|
||||
}
|
||||
return filtered;
|
||||
}
|
||||
std::vector<TestCase> const& getAllTestCasesSorted( IConfig const& config ) {
|
||||
|
Loading…
Reference in New Issue
Block a user