diff --git a/include/internal/catch_test_case_tracker.cpp b/include/internal/catch_test_case_tracker.cpp index 1ef830d1..9e75590c 100644 --- a/include/internal/catch_test_case_tracker.cpp +++ b/include/internal/catch_test_case_tracker.cpp @@ -139,7 +139,7 @@ namespace TestCaseTracking { m_runState = CompletedSuccessfully; break; case ExecutingChildren: - if( m_children.empty() || m_children.back()->isComplete() ) + if( std::all_of(m_children.begin(), m_children.end(), [](ITrackerPtr const& t){ return t->isComplete(); }) ) m_runState = CompletedSuccessfully; break; diff --git a/projects/CMakeLists.txt b/projects/CMakeLists.txt index c4a2b3ed..06b582ea 100644 --- a/projects/CMakeLists.txt +++ b/projects/CMakeLists.txt @@ -378,6 +378,8 @@ set_tests_properties(FilteredSection-2 PROPERTIES FAIL_REGULAR_EXPRESSION "No te add_test(NAME ApprovalTests COMMAND ${PYTHON_EXECUTABLE} ${CATCH_DIR}/scripts/approvalTests.py $) set_tests_properties(ApprovalTests PROPERTIES FAIL_REGULAR_EXPRESSION "Results differed") +add_test(NAME RegressionCheck-1670 COMMAND $ "#1670 regression check" -c A -r compact) +set_tests_properties(RegressionCheck-1670 PROPERTIES PASS_REGULAR_EXPRESSION "Passed 1 test case with 2 assertions.") if (CATCH_USE_VALGRIND) add_test(NAME ValgrindRunTests COMMAND valgrind --leak-check=full --error-exitcode=1 $) diff --git a/projects/SelfTest/IntrospectiveTests/PartTracker.tests.cpp b/projects/SelfTest/IntrospectiveTests/PartTracker.tests.cpp index 97423265..837d3661 100644 --- a/projects/SelfTest/IntrospectiveTests/PartTracker.tests.cpp +++ b/projects/SelfTest/IntrospectiveTests/PartTracker.tests.cpp @@ -189,3 +189,18 @@ TEST_CASE( "#1394 nested", "[.][approvals][tracker]" ) { REQUIRE(1 == 0); } } + +// Selecting a "not last" section inside a test case via -c "section" would +// previously only run the first subsection, instead of running all of them. +// This allows us to check that `"#1670 regression check" -c A` leads to +// 2 successful assertions. +TEST_CASE("#1670 regression check", "[.approvals][tracker]") { + SECTION("A") { + SECTION("1") SUCCEED(); + SECTION("2") SUCCEED(); + } + SECTION("B") { + SECTION("1") SUCCEED(); + SECTION("2") SUCCEED(); + } +}