Read-only mirrors. Development, issues and pull requests are on GitHub.

summaryrefslogtreecommitdiffhomepage
path: root/src/catch2/internal/catch_test_case_tracker.cpp
diff options
context:
space:
mode:
authorMartin Hořeňovský2026-07-07 14:09:04 +0200
committerMartin Hořeňovský2026-07-07 14:09:11 +0200
commitdd94b9a780e66651ff686083a66722386c540228 (patch)
tree69d06224dec4f48b3a95bc4814339946da4d3750 /src/catch2/internal/catch_test_case_tracker.cpp
parent9f7c9f6872308d4e7c32fff2f1ac6640aa866b6a (diff)
downloadcatch3-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.cpp22
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)))