Fix section filtering to make sense

Specifically, this commit makes the `-c`/`--section` parameter
strictly ordered and hierarchical, unlike how it behaved before,
which was a huge mess -- see #3038 for details.

Closes #3038
This commit is contained in:
Martin Hořeňovský
2025-10-14 22:14:47 +02:00
parent 33e6fd217a
commit 49d79e9e9c
6 changed files with 208 additions and 47 deletions

View File

@@ -129,12 +129,8 @@ namespace Catch {
for ( auto const& child : m_children ) {
if ( child->isSectionTracker() &&
std::find( filters.begin(),
filters.end(),
static_cast<SectionTracker const&>(
*child )
.trimmedName() ) !=
filters.end() ) {
static_cast<SectionTracker const&>( *child )
.trimmedName() == filters[0] ) {
return true;
}
}

View File

@@ -172,9 +172,9 @@ namespace TestCaseTracking {
bool SectionTracker::isComplete() const {
bool complete = true;
if (m_filters.empty()
if ( m_filters.empty()
|| m_filters[0].empty()
|| std::find(m_filters.begin(), m_filters.end(), m_trimmed_name) != m_filters.end()) {
|| m_filters[0] == m_trimmed_name ) {
complete = TrackerBase::isComplete();
}
return complete;