|
1 | 1 | /* |
2 | | - * Catch v2.13.2 |
3 | | - * Generated: 2020-10-07 11:32:53.302017 |
| 2 | + * Catch v2.13.3 |
| 3 | + * Generated: 2020-10-31 18:20:31.045274 |
4 | 4 | * ---------------------------------------------------------- |
5 | 5 | * This file has been merged from multiple headers. Please don't edit it directly |
6 | 6 | * Copyright (c) 2020 Two Blue Cubes Ltd. All rights reserved. |
|
15 | 15 |
|
16 | 16 | #define CATCH_VERSION_MAJOR 2 |
17 | 17 | #define CATCH_VERSION_MINOR 13 |
18 | | -#define CATCH_VERSION_PATCH 2 |
| 18 | +#define CATCH_VERSION_PATCH 3 |
19 | 19 |
|
20 | 20 | #ifdef __clang__ |
21 | 21 | # pragma clang system_header |
@@ -7602,6 +7602,10 @@ namespace TestCaseTracking { |
7602 | 7602 |
|
7603 | 7603 | void addInitialFilters( std::vector<std::string> const& filters ); |
7604 | 7604 | void addNextFilters( std::vector<std::string> const& filters ); |
| 7605 | + //! Returns filters active in this tracker |
| 7606 | + std::vector<std::string> const& getFilters() const; |
| 7607 | + //! Returns whitespace-trimmed name of the tracked section |
| 7608 | + std::string const& trimmedName() const; |
7605 | 7609 | }; |
7606 | 7610 |
|
7607 | 7611 | } // namespace TestCaseTracking |
@@ -12571,13 +12575,53 @@ namespace Catch { |
12571 | 12575 | // `SECTION`s. |
12572 | 12576 | // **The check for m_children.empty cannot be removed**. |
12573 | 12577 | // doing so would break `GENERATE` _not_ followed by `SECTION`s. |
12574 | | - const bool should_wait_for_child = |
12575 | | - !m_children.empty() && |
12576 | | - std::find_if( m_children.begin(), |
12577 | | - m_children.end(), |
12578 | | - []( TestCaseTracking::ITrackerPtr tracker ) { |
12579 | | - return tracker->hasStarted(); |
12580 | | - } ) == m_children.end(); |
| 12578 | + const bool should_wait_for_child = [&]() { |
| 12579 | + // No children -> nobody to wait for |
| 12580 | + if ( m_children.empty() ) { |
| 12581 | + return false; |
| 12582 | + } |
| 12583 | + // If at least one child started executing, don't wait |
| 12584 | + if ( std::find_if( |
| 12585 | + m_children.begin(), |
| 12586 | + m_children.end(), |
| 12587 | + []( TestCaseTracking::ITrackerPtr tracker ) { |
| 12588 | + return tracker->hasStarted(); |
| 12589 | + } ) != m_children.end() ) { |
| 12590 | + return false; |
| 12591 | + } |
| 12592 | + |
| 12593 | + // No children have started. We need to check if they _can_ |
| 12594 | + // start, and thus we should wait for them, or they cannot |
| 12595 | + // start (due to filters), and we shouldn't wait for them |
| 12596 | + auto* parent = m_parent; |
| 12597 | + // This is safe: there is always at least one section |
| 12598 | + // tracker in a test case tracking tree |
| 12599 | + while ( !parent->isSectionTracker() ) { |
| 12600 | + parent = &( parent->parent() ); |
| 12601 | + } |
| 12602 | + assert( parent && |
| 12603 | + "Missing root (test case) level section" ); |
| 12604 | + |
| 12605 | + auto const& parentSection = |
| 12606 | + static_cast<SectionTracker&>( *parent ); |
| 12607 | + auto const& filters = parentSection.getFilters(); |
| 12608 | + // No filters -> no restrictions on running sections |
| 12609 | + if ( filters.empty() ) { |
| 12610 | + return true; |
| 12611 | + } |
| 12612 | + |
| 12613 | + for ( auto const& child : m_children ) { |
| 12614 | + if ( child->isSectionTracker() && |
| 12615 | + std::find( filters.begin(), |
| 12616 | + filters.end(), |
| 12617 | + static_cast<SectionTracker&>( *child ) |
| 12618 | + .trimmedName() ) != |
| 12619 | + filters.end() ) { |
| 12620 | + return true; |
| 12621 | + } |
| 12622 | + } |
| 12623 | + return false; |
| 12624 | + }(); |
12581 | 12625 |
|
12582 | 12626 | // This check is a bit tricky, because m_generator->next() |
12583 | 12627 | // has a side-effect, where it consumes generator's current |
@@ -14449,6 +14493,14 @@ namespace TestCaseTracking { |
14449 | 14493 | m_filters.insert( m_filters.end(), filters.begin()+1, filters.end() ); |
14450 | 14494 | } |
14451 | 14495 |
|
| 14496 | + std::vector<std::string> const& SectionTracker::getFilters() const { |
| 14497 | + return m_filters; |
| 14498 | + } |
| 14499 | + |
| 14500 | + std::string const& SectionTracker::trimmedName() const { |
| 14501 | + return m_trimmed_name; |
| 14502 | + } |
| 14503 | + |
14452 | 14504 | } // namespace TestCaseTracking |
14453 | 14505 |
|
14454 | 14506 | using TestCaseTracking::ITracker; |
@@ -15264,7 +15316,7 @@ namespace Catch { |
15264 | 15316 | } |
15265 | 15317 |
|
15266 | 15318 | Version const& libraryVersion() { |
15267 | | - static Version version( 2, 13, 2, "", 0 ); |
| 15319 | + static Version version( 2, 13, 3, "", 0 ); |
15268 | 15320 | return version; |
15269 | 15321 | } |
15270 | 15322 |
|
|
0 commit comments