| 5863 | bool m_isFiltered = false; |
| 5864 | |
| 5865 | GeneratorTracker( |
| 5866 | TestCaseTracking::NameAndLocation&& nameAndLocation, |
| 5867 | TrackerContext& ctx, |
| 5868 | ITracker* parent, |
| 5869 | GeneratorBasePtr&& generator ): |
| 5870 | TrackerBase( CATCH_MOVE( nameAndLocation ), ctx, parent ), |
| 5871 | m_generator( CATCH_MOVE( generator ) ) { |
| 5872 | assert( m_generator && |
| 5873 | "Cannot create tracker without generator" ); |
| 5874 | |
| 5875 | // Handle potential filter and move forward here... |
| 5876 | // Old style filters do not affect generators at all |
| 5877 | if (m_newStyleFilters && m_allTrackerDepth < m_filterRef->size()) { |
| 5878 | auto const& filter = |
| 5879 | ( *m_filterRef )[m_allTrackerDepth]; |
| 5880 | // Generator cannot be un-entered the way a section |
| 5881 | // can be, so the tracker has to throw for a wrong |
| 5882 | // filter to stop the execution flow. |
| 5883 | if (filter.type == PathFilter::For::Section) { |
| 5884 | // We want the semantics of `SKIP()`, but we inline it |
| 5885 | // to avoid issues with conditionally prefixed macros |
| 5886 | INTERNAL_CATCH_MSG( |
| 5887 | "SKIP", |
| 5888 | Catch::ResultWas::ExplicitSkip, |
| 5889 | Catch::ResultDisposition::Normal, |
| 5890 | "" ); |
| 5891 | Catch::Detail::Unreachable(); |
| 5892 | } |
| 5893 | // '*' is the wildcard for "all elements in generator" |
| 5894 | // used for filtering sections below the generator, but |
| 5895 | // not the generator itself. |
| 5896 | if ( filter.filter != "*" ) { |
| 5897 | m_isFiltered = true; |
| 5898 | // TBD: We assume that the filter was validated as |
| 5899 | // number during parsing. We should pass it |
| 5900 | // as number from the CLI parser. |
| 5901 | size_t targetIndex = std::stoul( filter.filter ); |
| 5902 | m_generator->skipToNthElement( targetIndex ); |
| 5903 | } |
| 5904 | } |
| 5905 | } |
| 5906 | |
| 5907 | static GeneratorTracker* |
| 5908 | acquire( TrackerContext& ctx, |
nothing calls this directly
no test coverage detected