mirror of
https://github.com/catchorg/Catch2.git
synced 2024-11-22 21:36:11 +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() )
|
m_stream( openStream() )
|
||||||
{
|
{
|
||||||
TestSpecParser parser(ITagAliasRegistry::get());
|
TestSpecParser parser(ITagAliasRegistry::get());
|
||||||
if (data.testsOrTags.empty()) {
|
if (!data.testsOrTags.empty()) {
|
||||||
parser.parse("~[.]"); // All not hidden tests
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
m_hasTestFilters = true;
|
m_hasTestFilters = true;
|
||||||
for( auto const& testOrTags : data.testsOrTags )
|
for( auto const& testOrTags : data.testsOrTags )
|
||||||
parser.parse( testOrTags );
|
parser.parse( testOrTags );
|
||||||
|
@ -72,7 +72,10 @@ namespace Catch {
|
|||||||
|
|
||||||
auto const& allTestCases = getAllTestCasesSorted(*config);
|
auto const& allTestCases = getAllTestCasesSorted(*config);
|
||||||
for (auto const& testCase : allTestCases) {
|
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);
|
totals += context.runTest(testCase);
|
||||||
else
|
else
|
||||||
context.reporter().skipTest(testCase);
|
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> filterTests( std::vector<TestCase> const& testCases, TestSpec const& testSpec, IConfig const& config ) {
|
||||||
std::vector<TestCase> filtered;
|
std::vector<TestCase> filtered;
|
||||||
filtered.reserve( testCases.size() );
|
filtered.reserve( testCases.size() );
|
||||||
for( auto const& testCase : testCases )
|
for (auto const& testCase : testCases) {
|
||||||
if( matchTest( testCase, testSpec, config ) )
|
if ((!testSpec.hasFilters() && !testCase.isHidden()) ||
|
||||||
filtered.push_back( testCase );
|
(testSpec.hasFilters() && matchTest(testCase, testSpec, config))) {
|
||||||
|
filtered.push_back(testCase);
|
||||||
|
}
|
||||||
|
}
|
||||||
return filtered;
|
return filtered;
|
||||||
}
|
}
|
||||||
std::vector<TestCase> const& getAllTestCasesSorted( IConfig const& config ) {
|
std::vector<TestCase> const& getAllTestCasesSorted( IConfig const& config ) {
|
||||||
|
Loading…
Reference in New Issue
Block a user