Sections are, once again, eagerly entered.

When the section tracking code was rewritten a while back to simplify and iron out some bugs the order of evaluation was changed so that each new section was skipped on the first run through.
This had unwelcome consequences for some people.
This commit restores the original semantics (while maintaining the simpler, less buggy, new code).
This commit is contained in:
Phil Nash
2014-04-21 19:02:38 +01:00
parent d7e1790347
commit a020865990
10 changed files with 107 additions and 917 deletions

View File

@@ -2957,25 +2957,6 @@
<OverallResult success="true"/>
</TestCase>
<TestCase name="nested SECTION tests">
<Section name="s1" description="doesn't equal">
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/MiscTests.cpp" >
<Original>
a != b
</Original>
<Expanded>
1 != 2
</Expanded>
</Expression>
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/MiscTests.cpp" >
<Original>
b != a
</Original>
<Expanded>
2 != 1
</Expanded>
</Expression>
<OverallResults successes="2" failures="0"/>
</Section>
<Section name="s1" description="doesn't equal">
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/MiscTests.cpp" >
<Original>
@@ -3009,9 +2990,6 @@
<OverallResult success="true"/>
</TestCase>
<TestCase name="more nested SECTION tests">
<Section name="s1" description="doesn't equal">
<OverallResults successes="0" failures="0"/>
</Section>
<Section name="s1" description="doesn't equal">
<Section name="s2" description="equal">
<Expression success="false" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/MiscTests.cpp" >
@@ -3026,40 +3004,9 @@
</Section>
<OverallResults successes="0" failures="1"/>
</Section>
<Section name="s1" description="doesn't equal">
<Section name="s3" description="not equal">
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/MiscTests.cpp" >
<Original>
a != b
</Original>
<Expanded>
1 != 2
</Expanded>
</Expression>
<OverallResults successes="1" failures="0"/>
</Section>
<OverallResults successes="1" failures="0"/>
</Section>
<Section name="s1" description="doesn't equal">
<Section name="s4" description="less than">
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/MiscTests.cpp" >
<Original>
a &lt; b
</Original>
<Expanded>
1 &lt; 2
</Expanded>
</Expression>
<OverallResults successes="1" failures="0"/>
</Section>
<OverallResults successes="1" failures="0"/>
</Section>
<OverallResult success="false"/>
</TestCase>
<TestCase name="even more nested SECTION tests">
<Section name="c">
<OverallResults successes="0" failures="0"/>
</Section>
<Section name="c">
<Section name="d (leaf)">
<OverallResults successes="0" failures="1"/>
@@ -3498,22 +3445,6 @@
<OverallResult success="true"/>
</TestCase>
<TestCase name="vectors can be sized and resized">
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/MiscTests.cpp" >
<Original>
v.size() == 5
</Original>
<Expanded>
5 == 5
</Expanded>
</Expression>
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/MiscTests.cpp" >
<Original>
v.capacity() >= 5
</Original>
<Expanded>
5 >= 5
</Expanded>
</Expression>
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/MiscTests.cpp" >
<Original>
v.size() == 5
@@ -3565,41 +3496,6 @@
5 >= 5
</Expanded>
</Expression>
<Section name="resizing smaller changes size but not capacity">
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/MiscTests.cpp" >
<Original>
v.size() == 0
</Original>
<Expanded>
0 == 0
</Expanded>
</Expression>
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/MiscTests.cpp" >
<Original>
v.capacity() >= 5
</Original>
<Expanded>
5 >= 5
</Expanded>
</Expression>
<OverallResults successes="2" failures="0"/>
</Section>
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/MiscTests.cpp" >
<Original>
v.size() == 5
</Original>
<Expanded>
5 == 5
</Expanded>
</Expression>
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/MiscTests.cpp" >
<Original>
v.capacity() >= 5
</Original>
<Expanded>
5 >= 5
</Expanded>
</Expression>
<Section name="resizing smaller changes size but not capacity">
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/MiscTests.cpp" >
<Original>
@@ -3703,15 +3599,6 @@
<OverallResult success="true"/>
</TestCase>
<TestCase name="A couple of nested sections followed by a failure">
<Failure>
to infinity and beyond
</Failure>
<Section name="Outer">
<OverallResults successes="0" failures="0"/>
</Section>
<Failure>
to infinity and beyond
</Failure>
<Section name="Outer">
<Section name="Inner">
<OverallResults successes="1" failures="0"/>
@@ -3770,9 +3657,6 @@
</Expression>
<OverallResults successes="5" failures="0"/>
</Section>
<Section name="test lists">
<OverallResults successes="0" failures="0"/>
</Section>
<Section name="test lists">
<Section name="1 test" description="Specify one test case using">
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/TestMain.cpp" >
@@ -3933,9 +3817,6 @@
</Section>
<OverallResults successes="5" failures="0"/>
</Section>
<Section name="reporter">
<OverallResults successes="0" failures="0"/>
</Section>
<Section name="reporter">
<Section name="-r/console">
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/TestMain.cpp" >
@@ -4002,9 +3883,6 @@
</Section>
<OverallResults successes="2" failures="0"/>
</Section>
<Section name="debugger">
<OverallResults successes="0" failures="0"/>
</Section>
<Section name="debugger">
<Section name="-b">
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/TestMain.cpp" >
@@ -4049,9 +3927,6 @@
</Section>
<OverallResults successes="2" failures="0"/>
</Section>
<Section name="abort">
<OverallResults successes="0" failures="0"/>
</Section>
<Section name="abort">
<Section name="-a aborts after first failure">
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/TestMain.cpp" >
@@ -4126,9 +4001,6 @@
</Section>
<OverallResults successes="1" failures="0"/>
</Section>
<Section name="nothrow">
<OverallResults successes="0" failures="0"/>
</Section>
<Section name="nothrow">
<Section name="-e">
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/TestMain.cpp" >
@@ -4173,9 +4045,6 @@
</Section>
<OverallResults successes="2" failures="0"/>
</Section>
<Section name="output filename">
<OverallResults successes="0" failures="0"/>
</Section>
<Section name="output filename">
<Section name="-o filename">
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/TestMain.cpp" >
@@ -4220,9 +4089,6 @@
</Section>
<OverallResults successes="2" failures="0"/>
</Section>
<Section name="combinations">
<OverallResults successes="0" failures="0"/>
</Section>
<Section name="combinations">
<Section name="Single character flags can be combined">
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/TestMain.cpp" >
@@ -4788,9 +4654,6 @@
<OverallResult success="true"/>
</TestCase>
<TestCase name="Long strings can be wrapped">
<Section name="plain string">
<OverallResults successes="0" failures="0"/>
</Section>
<Section name="plain string">
<Section name="No wrapping">
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/TestMain.cpp" >
@@ -5117,9 +4980,6 @@ ur&quot;
</Section>
<OverallResults successes="1" failures="0"/>
</Section>
<Section name="With newlines">
<OverallResults successes="0" failures="0"/>
</Section>
<Section name="With newlines">
<Section name="No wrapping">
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/TestMain.cpp" >
@@ -6554,33 +6414,6 @@ there&quot;
<OverallResult success="true"/>
</TestCase>
<TestCase name="Assertions then sections">
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/TrickyTests.cpp" >
<Original>
Catch::isTrue( true )
</Original>
<Expanded>
true
</Expanded>
</Expression>
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/TrickyTests.cpp" >
<Original>
Catch::isTrue( true )
</Original>
<Expanded>
true
</Expanded>
</Expression>
<Section name="A section">
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/TrickyTests.cpp" >
<Original>
Catch::isTrue( true )
</Original>
<Expanded>
true
</Expanded>
</Expression>
<OverallResults successes="1" failures="0"/>
</Section>
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/TrickyTests.cpp" >
<Original>
Catch::isTrue( true )
@@ -6722,32 +6555,6 @@ there&quot;
<OverallResult success="true"/>
</TestCase>
<TestCase name="Scenario: Do that thing with the thing">
<Section name="Given: This stuff exists">
<OverallResults successes="0" failures="0"/>
</Section>
<Section name="Given: This stuff exists">
<Section name="When: I do this">
<OverallResults successes="0" failures="0"/>
</Section>
<OverallResults successes="0" failures="0"/>
</Section>
<Section name="Given: This stuff exists">
<Section name="When: I do this">
<Section name="Then: it should do this">
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/BDDTests.cpp" >
<Original>
itDoesThis()
</Original>
<Expanded>
true
</Expanded>
</Expression>
<OverallResults successes="1" failures="0"/>
</Section>
<OverallResults successes="1" failures="0"/>
</Section>
<OverallResults successes="1" failures="0"/>
</Section>
<Section name="Given: This stuff exists">
<Section name="When: I do this">
<Section name="Then: it should do this">
@@ -6779,100 +6586,6 @@ there&quot;
<OverallResult success="true"/>
</TestCase>
<TestCase name="Scenario: Vector resizing affects size and capacity">
<Section name="Given: an empty vector">
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/BDDTests.cpp" >
<Original>
v.size() == 0
</Original>
<Expanded>
0 == 0
</Expanded>
</Expression>
<OverallResults successes="1" failures="0"/>
</Section>
<Section name="Given: an empty vector">
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/BDDTests.cpp" >
<Original>
v.size() == 0
</Original>
<Expanded>
0 == 0
</Expanded>
</Expression>
<Section name="When: it is made larger">
<OverallResults successes="0" failures="0"/>
</Section>
<OverallResults successes="1" failures="0"/>
</Section>
<Section name="Given: an empty vector">
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/BDDTests.cpp" >
<Original>
v.size() == 0
</Original>
<Expanded>
0 == 0
</Expanded>
</Expression>
<Section name="When: it is made larger">
<Section name="Then: the size and capacity go up">
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/BDDTests.cpp" >
<Original>
v.size() == 10
</Original>
<Expanded>
10 == 10
</Expanded>
</Expression>
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/BDDTests.cpp" >
<Original>
v.capacity() >= 10
</Original>
<Expanded>
10 >= 10
</Expanded>
</Expression>
<OverallResults successes="2" failures="0"/>
</Section>
<OverallResults successes="2" failures="0"/>
</Section>
<OverallResults successes="3" failures="0"/>
</Section>
<Section name="Given: an empty vector">
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/BDDTests.cpp" >
<Original>
v.size() == 0
</Original>
<Expanded>
0 == 0
</Expanded>
</Expression>
<Section name="When: it is made larger">
<Section name="Then: the size and capacity go up">
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/BDDTests.cpp" >
<Original>
v.size() == 10
</Original>
<Expanded>
10 == 10
</Expanded>
</Expression>
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/BDDTests.cpp" >
<Original>
v.capacity() >= 10
</Original>
<Expanded>
10 >= 10
</Expanded>
</Expression>
<Section name="And when: it is made smaller again">
<OverallResults successes="0" failures="0"/>
</Section>
<OverallResults successes="2" failures="0"/>
</Section>
<OverallResults successes="2" failures="0"/>
</Section>
<OverallResults successes="3" failures="0"/>
</Section>
<Section name="Given: an empty vector">
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/BDDTests.cpp" >
<Original>
@@ -6928,20 +6641,6 @@ there&quot;
</Section>
<OverallResults successes="5" failures="0"/>
</Section>
<Section name="Given: an empty vector">
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/BDDTests.cpp" >
<Original>
v.size() == 0
</Original>
<Expanded>
0 == 0
</Expanded>
</Expression>
<Section name="When: we reserve more space">
<OverallResults successes="0" failures="0"/>
</Section>
<OverallResults successes="1" failures="0"/>
</Section>
<Section name="Given: an empty vector">
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/BDDTests.cpp" >
<Original>
@@ -6978,15 +6677,6 @@ there&quot;
<OverallResult success="true"/>
</TestCase>
<TestCase name="Scenario: This is a really long scenario name to see how the list command deals with wrapping">
<Section name="Given: A section name that is so long that it cannot fit in a single console width">
<OverallResults successes="0" failures="0"/>
</Section>
<Section name="Given: A section name that is so long that it cannot fit in a single console width">
<Section name="When: The test headers are printed as part of the normal running of the scenario">
<OverallResults successes="0" failures="0"/>
</Section>
<OverallResults successes="0" failures="0"/>
</Section>
<Section name="Given: A section name that is so long that it cannot fit in a single console width">
<Section name="When: The test headers are printed as part of the normal running of the scenario">
<Section name="Then: The, deliberately very long and overly verbose (you see what I did there?) section names must wrap, along with an indent">
@@ -6999,14 +6689,6 @@ there&quot;
<OverallResult success="true"/>
</TestCase>
<TestCase name="section tracking">
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/SectionTrackerTests.cpp" >
<Original>
!testCaseTracker.isCompleted()
</Original>
<Expanded>
!false
</Expanded>
</Expression>
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/SectionTrackerTests.cpp" >
<Original>
!testCaseTracker.isCompleted()
@@ -7043,30 +6725,6 @@ there&quot;
</Expanded>
</Expression>
<Section name="test case with one section">
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/SectionTrackerTests.cpp" >
<Original>
!testCaseTracker.enterSection( section1Name )
</Original>
<Expanded>
!false
</Expanded>
</Expression>
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/SectionTrackerTests.cpp" >
<Original>
!testCaseTracker.isCompleted()
</Original>
<Expanded>
!false
</Expanded>
</Expression>
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/SectionTrackerTests.cpp" >
<Original>
!testCaseTracker.isCompleted()
</Original>
<Expanded>
!false
</Expanded>
</Expression>
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/SectionTrackerTests.cpp" >
<Original>
testCaseTracker.enterSection( section1Name )
@@ -7075,6 +6733,14 @@ there&quot;
true
</Expanded>
</Expression>
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/SectionTrackerTests.cpp" >
<Original>
!testCaseTracker.isCompleted()
</Original>
<Expanded>
!false
</Expanded>
</Expression>
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/SectionTrackerTests.cpp" >
<Original>
testCaseTracker.isCompleted()
@@ -7083,7 +6749,15 @@ there&quot;
true
</Expanded>
</Expression>
<OverallResults successes="5" failures="0"/>
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/SectionTrackerTests.cpp" >
<Original>
!testCaseTracker.enterSection( section1Name )
</Original>
<Expanded>
!false
</Expanded>
</Expression>
<OverallResults successes="4" failures="0"/>
</Section>
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/SectionTrackerTests.cpp" >
<Original>
@@ -7094,30 +6768,6 @@ there&quot;
</Expanded>
</Expression>
<Section name="test case with two consecutive sections">
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/SectionTrackerTests.cpp" >
<Original>
!testCaseTracker.enterSection( section1Name )
</Original>
<Expanded>
!false
</Expanded>
</Expression>
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/SectionTrackerTests.cpp" >
<Original>
!testCaseTracker.enterSection( section2Name )
</Original>
<Expanded>
!false
</Expanded>
</Expression>
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/SectionTrackerTests.cpp" >
<Original>
!testCaseTracker.isCompleted()
</Original>
<Expanded>
!false
</Expanded>
</Expression>
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/SectionTrackerTests.cpp" >
<Original>
testCaseTracker.enterSection( section1Name )
@@ -7166,7 +6816,7 @@ there&quot;
true
</Expanded>
</Expression>
<OverallResults successes="9" failures="0"/>
<OverallResults successes="6" failures="0"/>
</Section>
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/SectionTrackerTests.cpp" >
<Original>
@@ -7177,46 +6827,6 @@ there&quot;
</Expanded>
</Expression>
<Section name="test case with one section within another">
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/SectionTrackerTests.cpp" >
<Original>
!testCaseTracker.enterSection( section1Name )
</Original>
<Expanded>
!false
</Expanded>
</Expression>
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/SectionTrackerTests.cpp" >
<Original>
!testCaseTracker.isCompleted()
</Original>
<Expanded>
!false
</Expanded>
</Expression>
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/SectionTrackerTests.cpp" >
<Original>
testCaseTracker.enterSection( section1Name )
</Original>
<Expanded>
true
</Expanded>
</Expression>
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/SectionTrackerTests.cpp" >
<Original>
!testCaseTracker.enterSection( section2Name )
</Original>
<Expanded>
!false
</Expanded>
</Expression>
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/SectionTrackerTests.cpp" >
<Original>
!testCaseTracker.isCompleted()
</Original>
<Expanded>
!false
</Expanded>
</Expression>
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/SectionTrackerTests.cpp" >
<Original>
testCaseTracker.enterSection( section1Name )
@@ -7233,6 +6843,14 @@ there&quot;
true
</Expanded>
</Expression>
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/SectionTrackerTests.cpp" >
<Original>
!testCaseTracker.isCompleted()
</Original>
<Expanded>
!false
</Expanded>
</Expression>
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/SectionTrackerTests.cpp" >
<Original>
testCaseTracker.isCompleted()
@@ -7241,11 +6859,11 @@ there&quot;
true
</Expanded>
</Expression>
<OverallResults successes="8" failures="0"/>
<OverallResults successes="4" failures="0"/>
</Section>
<OverallResult success="true"/>
</TestCase>
<OverallResults successes="568" failures="112"/>
<OverallResults successes="536" failures="110"/>
</Group>
<OverallResults successes="568" failures="112"/>
<OverallResults successes="536" failures="110"/>
</Catch>