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

summaryrefslogtreecommitdiffhomepage
path: root/single_include
diff options
context:
space:
mode:
authorMartin Hořeňovský2020-10-31 18:21:23 +0100
committerMartin Hořeňovský2020-10-31 18:21:23 +0100
commitff349a50bfc6214b4081f4ca63c7de35e2162f60 (patch)
tree13a5e9fd89765c92c2456cf7bc54b251c7f5190b /single_include
parentaca2472d40250cd288f88073f268e4308a0300ae (diff)
downloadcatch3-2.13.3.tar.gz
v2.13.3v2.13.3
Diffstat (limited to 'single_include')
-rw-r--r--single_include/catch2/catch.hpp74
1 files changed, 63 insertions, 11 deletions
diff --git a/single_include/catch2/catch.hpp b/single_include/catch2/catch.hpp
index 506cfe44..2a2d77a2 100644
--- a/single_include/catch2/catch.hpp
+++ b/single_include/catch2/catch.hpp
@@ -1,6 +1,6 @@
/*
- * Catch v2.13.2
- * Generated: 2020-10-07 11:32:53.302017
+ * Catch v2.13.3
+ * Generated: 2020-10-31 18:20:31.045274
* ----------------------------------------------------------
* This file has been merged from multiple headers. Please don't edit it directly
* Copyright (c) 2020 Two Blue Cubes Ltd. All rights reserved.
@@ -15,7 +15,7 @@
#define CATCH_VERSION_MAJOR 2
#define CATCH_VERSION_MINOR 13
-#define CATCH_VERSION_PATCH 2
+#define CATCH_VERSION_PATCH 3
#ifdef __clang__
# pragma clang system_header
@@ -7602,6 +7602,10 @@ namespace TestCaseTracking {
void addInitialFilters( std::vector<std::string> const& filters );
void addNextFilters( std::vector<std::string> const& filters );
+ //! Returns filters active in this tracker
+ std::vector<std::string> const& getFilters() const;
+ //! Returns whitespace-trimmed name of the tracked section
+ std::string const& trimmedName() const;
};
} // namespace TestCaseTracking
@@ -12571,13 +12575,53 @@ namespace Catch {
// `SECTION`s.
// **The check for m_children.empty cannot be removed**.
// doing so would break `GENERATE` _not_ followed by `SECTION`s.
- const bool should_wait_for_child =
- !m_children.empty() &&
- std::find_if( m_children.begin(),
- m_children.end(),
- []( TestCaseTracking::ITrackerPtr tracker ) {
- return tracker->hasStarted();
- } ) == m_children.end();
+ const bool should_wait_for_child = [&]() {
+ // No children -> nobody to wait for
+ if ( m_children.empty() ) {
+ return false;
+ }
+ // If at least one child started executing, don't wait
+ if ( std::find_if(
+ m_children.begin(),
+ m_children.end(),
+ []( TestCaseTracking::ITrackerPtr tracker ) {
+ return tracker->hasStarted();
+ } ) != m_children.end() ) {
+ return false;
+ }
+
+ // No children have started. We need to check if they _can_
+ // start, and thus we should wait for them, or they cannot
+ // start (due to filters), and we shouldn't wait for them
+ auto* parent = m_parent;
+ // This is safe: there is always at least one section
+ // tracker in a test case tracking tree
+ while ( !parent->isSectionTracker() ) {
+ parent = &( parent->parent() );
+ }
+ assert( parent &&
+ "Missing root (test case) level section" );
+
+ auto const& parentSection =
+ static_cast<SectionTracker&>( *parent );
+ auto const& filters = parentSection.getFilters();
+ // No filters -> no restrictions on running sections
+ if ( filters.empty() ) {
+ return true;
+ }
+
+ for ( auto const& child : m_children ) {
+ if ( child->isSectionTracker() &&
+ std::find( filters.begin(),
+ filters.end(),
+ static_cast<SectionTracker&>( *child )
+ .trimmedName() ) !=
+ filters.end() ) {
+ return true;
+ }
+ }
+ return false;
+ }();
// This check is a bit tricky, because m_generator->next()
// has a side-effect, where it consumes generator's current
@@ -14449,6 +14493,14 @@ namespace TestCaseTracking {
m_filters.insert( m_filters.end(), filters.begin()+1, filters.end() );
}
+ std::vector<std::string> const& SectionTracker::getFilters() const {
+ return m_filters;
+ }
+
+ std::string const& SectionTracker::trimmedName() const {
+ return m_trimmed_name;
+ }
+
} // namespace TestCaseTracking
using TestCaseTracking::ITracker;
@@ -15264,7 +15316,7 @@ namespace Catch {
}
Version const& libraryVersion() {
- static Version version( 2, 13, 2, "", 0 );
+ static Version version( 2, 13, 3, "", 0 );
return version;
}