Support filtering on both sections and generators (#3069)

Not being able to filter generators to specific element has been regularly
causing problems. It was possible to use a dynamic section to run tests
for specific element in a generator, at least if the element had a nice
string representation, but the test case would still run once per element
in the generator.

With this change, it is possible to have the generator return only one
specific element, and do so based on the index, rather than the string
representation of the element. This enables simple debugging of tests
that fail for specific generator element.
This commit is contained in:
Martin Hořeňovský authored and GitHub committed 2026-02-15 20:27:15 +01:00
1 parent b6c7b217d4
commit 3a0cf7e75f
42 files changed
+1716 -159

No files matched your search

@@ -9,6 +9,7 @@
#include <catch2/catch_test_macros.hpp>
#include <catch2/generators/catch_generators.hpp>
#include <catch2/internal/catch_test_case_tracker.hpp>
#include <catch2/internal/catch_path_filter.hpp>
using namespace Catch;
@@ -22,7 +23,9 @@ Catch::TestCaseTracking::NameAndLocationRef makeNAL( StringRef name ) {
TEST_CASE( "Tracker" ) {
TrackerContext ctx;
ctx.startRun();
ITracker& root = ctx.startRun();
std::vector<PathFilter> dummyFilters;
root.setFilters( &dummyFilters, false );
ctx.startCycle();