diff options
| author | Martin Hořeňovský | 2026-07-07 14:09:04 +0200 |
|---|---|---|
| committer | Martin Hořeňovský | 2026-07-07 14:09:11 +0200 |
| commit | dd94b9a780e66651ff686083a66722386c540228 (patch) | |
| tree | 69d06224dec4f48b3a95bc4814339946da4d3750 /src/catch2/internal/catch_test_case_tracker.cpp | |
| parent | 9f7c9f6872308d4e7c32fff2f1ac6640aa866b6a (diff) | |
| download | catch3-dd94b9a780e66651ff686083a66722386c540228.tar.gz | |
Fix --warn InfiniteGenerators firing even if the generator was filtered
Diffstat (limited to 'src/catch2/internal/catch_test_case_tracker.cpp')
| -rw-r--r-- | src/catch2/internal/catch_test_case_tracker.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/catch2/internal/catch_test_case_tracker.cpp b/src/catch2/internal/catch_test_case_tracker.cpp index 05bfff8e..864cf11b 100644 --- a/src/catch2/internal/catch_test_case_tracker.cpp +++ b/src/catch2/internal/catch_test_case_tracker.cpp @@ -167,6 +167,28 @@ namespace TestCaseTracking { m_ctx.setCurrentTracker( this ); } + bool SectionTracker::isFilteredImpl() const { + // TBD: This is currently _very_ similar to the block in `isComplete`. + // Is this neccessarily that way, or just accident of current semantics? + const size_t filterIndex = + m_newStyleFilters ? m_allTrackerDepth : m_sectionOnlyDepth; + + if ( filterIndex < m_filterRef->size() ) { + // 1) New style filter must explicitly target section + if ( m_newStyleFilters && ( *m_filterRef )[filterIndex].type != + PathFilter::For::Section ) { + return true; + } + // 2) Both style filters must match the trimmed name exactly + if ( m_trimmed_name != + StringRef( ( *m_filterRef )[filterIndex].filter ) ) { + return true; + } + } + + return false; + } + SectionTracker::SectionTracker( NameAndLocation&& nameAndLocation, TrackerContext& ctx, ITracker* parent ) : TrackerBase( CATCH_MOVE(nameAndLocation), ctx, parent ), m_trimmed_name(trim(StringRef(ITracker::nameAndLocation().name))) |