mirror of
https://github.com/catchorg/Catch2.git
synced 2025-08-03 13:55:39 +02:00
Modify generator tracking to allow GENERATEs between SECTIONs
This means that code such as ```cpp TEST_CASE() { SECTION("first") { SUCCEED(); } auto _ = GENERATE(1, 2); SECTION("second") { SUCCEED(); } } ``` will run and report 3 assertions, 1 from section "first" and 2 from section "second". This also applies for greater and potentially more confusing nesting, but fundamentally it is up to the user to avoid overly complex and confusing nestings, just as with `SECTION`s. The old behaviour of `GENERATE` as first thing in a `TEST_CASE`, `GENERATE` not followed by a `SECTION`, etc etc should be unchanged. Closes #1938
This commit is contained in:
@@ -305,6 +305,342 @@ Nor would this
|
||||
</Expression>
|
||||
<OverallResult success="true"/>
|
||||
</TestCase>
|
||||
<TestCase name="#1938 - GENERATE after a section" tags="[.][generators][regression]" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
|
||||
<Section name="A" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
|
||||
<OverallResults successes="1" failures="0" expectedFailures="0"/>
|
||||
</Section>
|
||||
<Section name="B" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
|
||||
<Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
|
||||
<Original>
|
||||
m
|
||||
</Original>
|
||||
<Expanded>
|
||||
1
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<OverallResults successes="1" failures="0" expectedFailures="0"/>
|
||||
</Section>
|
||||
<Section name="B" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
|
||||
<Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
|
||||
<Original>
|
||||
m
|
||||
</Original>
|
||||
<Expanded>
|
||||
2
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<OverallResults successes="1" failures="0" expectedFailures="0"/>
|
||||
</Section>
|
||||
<Section name="B" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
|
||||
<Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
|
||||
<Original>
|
||||
m
|
||||
</Original>
|
||||
<Expanded>
|
||||
3
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<OverallResults successes="1" failures="0" expectedFailures="0"/>
|
||||
</Section>
|
||||
<OverallResult success="true"/>
|
||||
</TestCase>
|
||||
<TestCase name="#1938 - Section followed by flat generate" tags="[.][generators][regression]" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
|
||||
<Section name="A" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
|
||||
<Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
|
||||
<Original>
|
||||
1
|
||||
</Original>
|
||||
<Expanded>
|
||||
1
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<OverallResults successes="1" failures="0" expectedFailures="0"/>
|
||||
</Section>
|
||||
<Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
|
||||
<Original>
|
||||
m
|
||||
</Original>
|
||||
<Expanded>
|
||||
2
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
|
||||
<Original>
|
||||
m
|
||||
</Original>
|
||||
<Expanded>
|
||||
3
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<OverallResult success="true"/>
|
||||
</TestCase>
|
||||
<TestCase name="#1938 - flat generate" tags="[.][generators][regression]" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
|
||||
<Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
|
||||
<Original>
|
||||
m
|
||||
</Original>
|
||||
<Expanded>
|
||||
1
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
|
||||
<Original>
|
||||
m
|
||||
</Original>
|
||||
<Expanded>
|
||||
2
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
|
||||
<Original>
|
||||
m
|
||||
</Original>
|
||||
<Expanded>
|
||||
3
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<OverallResult success="true"/>
|
||||
</TestCase>
|
||||
<TestCase name="#1938 - mixed sections and generates" tags="[.][generators][regression]" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
|
||||
<Section name="A" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
|
||||
<OverallResults successes="1" failures="0" expectedFailures="0"/>
|
||||
</Section>
|
||||
<Info>
|
||||
i := 1
|
||||
</Info>
|
||||
<Info>
|
||||
j := 3
|
||||
</Info>
|
||||
<Info>
|
||||
k := 5
|
||||
</Info>
|
||||
<Section name="B" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
|
||||
<OverallResults successes="1" failures="0" expectedFailures="0"/>
|
||||
</Section>
|
||||
<Info>
|
||||
i := 1
|
||||
</Info>
|
||||
<Info>
|
||||
j := 3
|
||||
</Info>
|
||||
<Info>
|
||||
k := 6
|
||||
</Info>
|
||||
<Section name="B" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
|
||||
<OverallResults successes="1" failures="0" expectedFailures="0"/>
|
||||
</Section>
|
||||
<Info>
|
||||
i := 1
|
||||
</Info>
|
||||
<Info>
|
||||
j := 4
|
||||
</Info>
|
||||
<Info>
|
||||
k := 5
|
||||
</Info>
|
||||
<Info>
|
||||
i := 1
|
||||
</Info>
|
||||
<Info>
|
||||
j := 4
|
||||
</Info>
|
||||
<Info>
|
||||
k := 6
|
||||
</Info>
|
||||
<Section name="A" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
|
||||
<OverallResults successes="1" failures="0" expectedFailures="0"/>
|
||||
</Section>
|
||||
<Info>
|
||||
i := 2
|
||||
</Info>
|
||||
<Info>
|
||||
j := 3
|
||||
</Info>
|
||||
<Info>
|
||||
k := 5
|
||||
</Info>
|
||||
<Section name="B" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
|
||||
<OverallResults successes="1" failures="0" expectedFailures="0"/>
|
||||
</Section>
|
||||
<Info>
|
||||
i := 2
|
||||
</Info>
|
||||
<Info>
|
||||
j := 3
|
||||
</Info>
|
||||
<Info>
|
||||
k := 6
|
||||
</Info>
|
||||
<Section name="B" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
|
||||
<OverallResults successes="1" failures="0" expectedFailures="0"/>
|
||||
</Section>
|
||||
<Info>
|
||||
i := 2
|
||||
</Info>
|
||||
<Info>
|
||||
j := 4
|
||||
</Info>
|
||||
<Info>
|
||||
k := 5
|
||||
</Info>
|
||||
<Info>
|
||||
i := 2
|
||||
</Info>
|
||||
<Info>
|
||||
j := 4
|
||||
</Info>
|
||||
<Info>
|
||||
k := 6
|
||||
</Info>
|
||||
<OverallResult success="true"/>
|
||||
</TestCase>
|
||||
<TestCase name="#1938 - nested generate" tags="[.][generators][regression]" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
|
||||
<Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
|
||||
<Original>
|
||||
m
|
||||
</Original>
|
||||
<Expanded>
|
||||
1
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
|
||||
<Original>
|
||||
n
|
||||
</Original>
|
||||
<Expanded>
|
||||
1
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
|
||||
<Original>
|
||||
m
|
||||
</Original>
|
||||
<Expanded>
|
||||
1
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
|
||||
<Original>
|
||||
n
|
||||
</Original>
|
||||
<Expanded>
|
||||
2
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
|
||||
<Original>
|
||||
m
|
||||
</Original>
|
||||
<Expanded>
|
||||
1
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
|
||||
<Original>
|
||||
n
|
||||
</Original>
|
||||
<Expanded>
|
||||
3
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
|
||||
<Original>
|
||||
m
|
||||
</Original>
|
||||
<Expanded>
|
||||
2
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
|
||||
<Original>
|
||||
n
|
||||
</Original>
|
||||
<Expanded>
|
||||
1
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
|
||||
<Original>
|
||||
m
|
||||
</Original>
|
||||
<Expanded>
|
||||
2
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
|
||||
<Original>
|
||||
n
|
||||
</Original>
|
||||
<Expanded>
|
||||
2
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
|
||||
<Original>
|
||||
m
|
||||
</Original>
|
||||
<Expanded>
|
||||
2
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
|
||||
<Original>
|
||||
n
|
||||
</Original>
|
||||
<Expanded>
|
||||
3
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
|
||||
<Original>
|
||||
m
|
||||
</Original>
|
||||
<Expanded>
|
||||
3
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
|
||||
<Original>
|
||||
n
|
||||
</Original>
|
||||
<Expanded>
|
||||
1
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
|
||||
<Original>
|
||||
m
|
||||
</Original>
|
||||
<Expanded>
|
||||
3
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
|
||||
<Original>
|
||||
n
|
||||
</Original>
|
||||
<Expanded>
|
||||
2
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
|
||||
<Original>
|
||||
m
|
||||
</Original>
|
||||
<Expanded>
|
||||
3
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
|
||||
<Original>
|
||||
n
|
||||
</Original>
|
||||
<Expanded>
|
||||
3
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<OverallResult success="true"/>
|
||||
</TestCase>
|
||||
<TestCase name="#1954 - 7 arg template test case sig compiles - 1, 1, 1, 1, 1, 0, 0" tags="[.][compilation][regression]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" >
|
||||
<OverallResult success="true"/>
|
||||
</TestCase>
|
||||
@@ -18175,9 +18511,9 @@ loose text artifact
|
||||
</Section>
|
||||
<OverallResult success="true"/>
|
||||
</TestCase>
|
||||
<OverallResults successes="1789" failures="149" expectedFailures="21"/>
|
||||
<OverallResultsCases successes="253" failures="86" expectedFailures="4"/>
|
||||
<OverallResults successes="1831" failures="149" expectedFailures="21"/>
|
||||
<OverallResultsCases successes="258" failures="86" expectedFailures="4"/>
|
||||
</Group>
|
||||
<OverallResults successes="1789" failures="148" expectedFailures="21"/>
|
||||
<OverallResultsCases successes="253" failures="86" expectedFailures="4"/>
|
||||
<OverallResults successes="1831" failures="148" expectedFailures="21"/>
|
||||
<OverallResultsCases successes="258" failures="86" expectedFailures="4"/>
|
||||
</Catch>
|
||||
|
Reference in New Issue
Block a user