diff options
| author | Martin Hořeňovský | 2026-02-15 20:27:15 +0100 |
|---|---|---|
| committer | GitHub | 2026-02-15 20:27:15 +0100 |
| commit | 3a0cf7e75fdc571ff9ed25303fb268665f6260c0 (patch) | |
| tree | 25cd180f4419e0ef2f6fbe3664f91b548c59d8c2 /src/catch2/catch_config.cpp | |
| parent | b6c7b217d4bcb5030ce1e04180f35d02bcf5d93f (diff) | |
| download | catch3-3a0cf7e75fdc571ff9ed25303fb268665f6260c0.tar.gz | |
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.
Diffstat (limited to 'src/catch2/catch_config.cpp')
| -rw-r--r-- | src/catch2/catch_config.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/catch2/catch_config.cpp b/src/catch2/catch_config.cpp index f83821a7..b4584f3c 100644 --- a/src/catch2/catch_config.cpp +++ b/src/catch2/catch_config.cpp @@ -92,6 +92,10 @@ namespace Catch { lhs.customOptions == rhs.customOptions; } + bool operator==( PathFilter const& lhs, PathFilter const& rhs ) { + return lhs.type == rhs.type && lhs.filter == rhs.filter; + } + Config::Config( ConfigData const& data ): m_data( data ) { // We need to trim filter specs to avoid trouble with superfluous @@ -101,9 +105,6 @@ namespace Catch { for (auto& elem : m_data.testsOrTags) { elem = trim(elem); } - for (auto& elem : m_data.sectionsToRun) { - elem = trim(elem); - } // Insert the default reporter if user hasn't asked for a specific one if ( m_data.reporterSpecifications.empty() ) { @@ -169,7 +170,8 @@ namespace Catch { bool Config::listListeners() const { return m_data.listListeners; } std::vector<std::string> const& Config::getTestsOrTags() const { return m_data.testsOrTags; } - std::vector<std::string> const& Config::getSectionsToRun() const { return m_data.sectionsToRun; } + std::vector<PathFilter> const& Config::getPathFilters() const { return m_data.pathFilters; } + bool Config::useNewFilterBehaviour() const { return m_data.useNewPathFilteringBehaviour; } std::vector<ReporterSpec> const& Config::getReporterSpecs() const { return m_data.reporterSpecifications; |