Progmasoft Git

catch3

Progmasoft Catch3: an independently maintained C++17 test framework with a parallel runner, property checks, snapshots and structured results.

Clonegit clone https://git.progmasoft.com/catch3

Add tests for #961

Commit
4f21bb72ff16f82b7fcf7362d683547f412641f4
Author
Martin Hořeňovský ·
Parents
b435e0d7c79f

Files · Download .tar.gz

Changes

 .../SelfTest/Baselines/console.std.approved.txt    |  4 +-
 .../SelfTest/Baselines/console.sw.approved.txt     | 64 +++++++++++++++++++++-
 .../SelfTest/Baselines/console.swa4.approved.txt   | 64 +++++++++++++++++++++-
 projects/SelfTest/Baselines/junit.sw.approved.txt  |  7 ++-
 projects/SelfTest/Baselines/xml.sw.approved.txt    | 22 +++++++-
 projects/SelfTest/MiscTests.cpp                    |  8 +++
 6 files changed, 160 insertions(+), 9 deletions(-)

diff --git a/projects/SelfTest/Baselines/console.std.approved.txt b/projects/SelfTest/Baselines/console.std.approved.txt
index 439da767..21818733 100644
--- a/projects/SelfTest/Baselines/console.std.approved.txt
+++ b/projects/SelfTest/Baselines/console.std.approved.txt
@@ -956,6 +956,6 @@ with expansion:
   "first" == "second"
 
 ===============================================================================
-test cases: 169 | 120 passed | 45 failed |  4 failed as expected
-assertions: 968 | 859 passed | 88 failed | 21 failed as expected
+test cases: 170 | 121 passed | 45 failed |  4 failed as expected
+assertions: 973 | 864 passed | 88 failed | 21 failed as expected
 
diff --git a/projects/SelfTest/Baselines/console.sw.approved.txt b/projects/SelfTest/Baselines/console.sw.approved.txt
index 9cb93b13..4288952c 100644
--- a/projects/SelfTest/Baselines/console.sw.approved.txt
+++ b/projects/SelfTest/Baselines/console.sw.approved.txt
@@ -123,6 +123,66 @@ PASSED:
 with expansion:
   1 == 1
 
+-------------------------------------------------------------------------------
+#961 -- Dynamically created sections should all be reported
+  Looped section 0
+-------------------------------------------------------------------------------
+MiscTests.cpp:<line number>
+...............................................................................
+
+MiscTests.cpp:<line number>:
+PASSED:
+with message:
+  Everything is OK
+
+-------------------------------------------------------------------------------
+#961 -- Dynamically created sections should all be reported
+  Looped section 1
+-------------------------------------------------------------------------------
+MiscTests.cpp:<line number>
+...............................................................................
+
+MiscTests.cpp:<line number>:
+PASSED:
+with message:
+  Everything is OK
+
+-------------------------------------------------------------------------------
+#961 -- Dynamically created sections should all be reported
+  Looped section 2
+-------------------------------------------------------------------------------
+MiscTests.cpp:<line number>
+...............................................................................
+
+MiscTests.cpp:<line number>:
+PASSED:
+with message:
+  Everything is OK
+
+-------------------------------------------------------------------------------
+#961 -- Dynamically created sections should all be reported
+  Looped section 3
+-------------------------------------------------------------------------------
+MiscTests.cpp:<line number>
+...............................................................................
+
+MiscTests.cpp:<line number>:
+PASSED:
+with message:
+  Everything is OK
+
+-------------------------------------------------------------------------------
+#961 -- Dynamically created sections should all be reported
+  Looped section 4
+-------------------------------------------------------------------------------
+MiscTests.cpp:<line number>
+...............................................................................
+
+MiscTests.cpp:<line number>:
+PASSED:
+with message:
+  Everything is OK
+
 -------------------------------------------------------------------------------
 'Not' checks that should fail
 -------------------------------------------------------------------------------
@@ -9516,6 +9576,6 @@ MiscTests.cpp:<line number>:
 PASSED:
 
 ===============================================================================
-test cases: 169 | 118 passed | 47 failed |  4 failed as expected
-assertions: 973 | 859 passed | 93 failed | 21 failed as expected
+test cases: 170 | 119 passed | 47 failed |  4 failed as expected
+assertions: 978 | 864 passed | 93 failed | 21 failed as expected
 
diff --git a/projects/SelfTest/Baselines/console.swa4.approved.txt b/projects/SelfTest/Baselines/console.swa4.approved.txt
index a23a6ab7..0e0380bb 100644
--- a/projects/SelfTest/Baselines/console.swa4.approved.txt
+++ b/projects/SelfTest/Baselines/console.swa4.approved.txt
@@ -123,6 +123,66 @@ PASSED:
 with expansion:
   1 == 1
 
+-------------------------------------------------------------------------------
+#961 -- Dynamically created sections should all be reported
+  Looped section 0
+-------------------------------------------------------------------------------
+MiscTests.cpp:<line number>
+...............................................................................
+
+MiscTests.cpp:<line number>:
+PASSED:
+with message:
+  Everything is OK
+
+-------------------------------------------------------------------------------
+#961 -- Dynamically created sections should all be reported
+  Looped section 1
+-------------------------------------------------------------------------------
+MiscTests.cpp:<line number>
+...............................................................................
+
+MiscTests.cpp:<line number>:
+PASSED:
+with message:
+  Everything is OK
+
+-------------------------------------------------------------------------------
+#961 -- Dynamically created sections should all be reported
+  Looped section 2
+-------------------------------------------------------------------------------
+MiscTests.cpp:<line number>
+...............................................................................
+
+MiscTests.cpp:<line number>:
+PASSED:
+with message:
+  Everything is OK
+
+-------------------------------------------------------------------------------
+#961 -- Dynamically created sections should all be reported
+  Looped section 3
+-------------------------------------------------------------------------------
+MiscTests.cpp:<line number>
+...............................................................................
+
+MiscTests.cpp:<line number>:
+PASSED:
+with message:
+  Everything is OK
+
+-------------------------------------------------------------------------------
+#961 -- Dynamically created sections should all be reported
+  Looped section 4
+-------------------------------------------------------------------------------
+MiscTests.cpp:<line number>
+...............................................................................
+
+MiscTests.cpp:<line number>:
+PASSED:
+with message:
+  Everything is OK
+
 -------------------------------------------------------------------------------
 'Not' checks that should fail
 -------------------------------------------------------------------------------
@@ -144,6 +204,6 @@ ConditionTests.cpp:<line number>: FAILED:
   CHECK_FALSE( true )
 
 ===============================================================================
-test cases:  6 |  3 passed | 1 failed | 2 failed as expected
-assertions: 18 | 11 passed | 4 failed | 3 failed as expected
+test cases:  7 |  4 passed | 1 failed | 2 failed as expected
+assertions: 23 | 16 passed | 4 failed | 3 failed as expected
 
diff --git a/projects/SelfTest/Baselines/junit.sw.approved.txt b/projects/SelfTest/Baselines/junit.sw.approved.txt
index d8b788e3..5fe36bae 100644
--- a/projects/SelfTest/Baselines/junit.sw.approved.txt
+++ b/projects/SelfTest/Baselines/junit.sw.approved.txt
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <testsuitesspanner>
-  <testsuite name="<exe-name>" errors="13" failures="81" tests="974" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}">
+  <testsuite name="<exe-name>" errors="13" failures="81" tests="979" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}">
     <testcase classname="global" name="# A test name that starts with a #" time="{duration}"/>
     <testcase classname="#748 - captures with unexpected exceptions" name="outside assertions" time="{duration}">
       <error type="TEST_CASE">
@@ -24,6 +24,11 @@ ExceptionTests.cpp:<line number>
 MiscTests.cpp:<line number>
       </failure>
     </testcase>
+    <testcase classname="#961 -- Dynamically created sections should all be reported" name="Looped section 0" time="{duration}"/>
+    <testcase classname="#961 -- Dynamically created sections should all be reported" name="Looped section 1" time="{duration}"/>
+    <testcase classname="#961 -- Dynamically created sections should all be reported" name="Looped section 2" time="{duration}"/>
+    <testcase classname="#961 -- Dynamically created sections should all be reported" name="Looped section 3" time="{duration}"/>
+    <testcase classname="#961 -- Dynamically created sections should all be reported" name="Looped section 4" time="{duration}"/>
     <testcase classname="global" name="'Not' checks that should fail" time="{duration}">
       <failure message="false != false" type="CHECK">
 ConditionTests.cpp:<line number>
diff --git a/projects/SelfTest/Baselines/xml.sw.approved.txt b/projects/SelfTest/Baselines/xml.sw.approved.txt
index e1030964..aedbfedb 100644
--- a/projects/SelfTest/Baselines/xml.sw.approved.txt
+++ b/projects/SelfTest/Baselines/xml.sw.approved.txt
@@ -136,6 +136,24 @@
       </Expression>
       <OverallResult success="true"/>
     </TestCase>
+    <TestCase name="#961 -- Dynamically created sections should all be reported" tags="[.][hide]" filename="projects/<exe-name>/MiscTests.cpp" >
+      <Section name="Looped section 0" filename="projects/<exe-name>/MiscTests.cpp" >
+        <OverallResults successes="1" failures="0" expectedFailures="0"/>
+      </Section>
+      <Section name="Looped section 1" filename="projects/<exe-name>/MiscTests.cpp" >
+        <OverallResults successes="1" failures="0" expectedFailures="0"/>
+      </Section>
+      <Section name="Looped section 2" filename="projects/<exe-name>/MiscTests.cpp" >
+        <OverallResults successes="1" failures="0" expectedFailures="0"/>
+      </Section>
+      <Section name="Looped section 3" filename="projects/<exe-name>/MiscTests.cpp" >
+        <OverallResults successes="1" failures="0" expectedFailures="0"/>
+      </Section>
+      <Section name="Looped section 4" filename="projects/<exe-name>/MiscTests.cpp" >
+        <OverallResults successes="1" failures="0" expectedFailures="0"/>
+      </Section>
+      <OverallResult success="true"/>
+    </TestCase>
     <TestCase name="'Not' checks that should fail" tags="[.][failing][hide]" filename="projects/<exe-name>/ConditionTests.cpp" >
       <Expression success="false" type="CHECK" filename="projects/<exe-name>/ConditionTests.cpp" >
         <Original>
@@ -10161,7 +10179,7 @@ spanner      <OverallResult success="true"/>
       </Section>
       <OverallResult success="true"/>
     </TestCase>
-    <OverallResults successes="859" failures="94" expectedFailures="21"/>
+    <OverallResults successes="864" failures="94" expectedFailures="21"/>
   </Group>
-  <OverallResults successes="859" failures="93" expectedFailures="21"/>
+  <OverallResults successes="864" failures="93" expectedFailures="21"/>
 </Catch>
diff --git a/projects/SelfTest/MiscTests.cpp b/projects/SelfTest/MiscTests.cpp
index 24e3d7d3..39a0ac23 100644
--- a/projects/SelfTest/MiscTests.cpp
+++ b/projects/SelfTest/MiscTests.cpp
@@ -405,3 +405,11 @@ TEST_CASE( "#835 -- errno should not be touched by Catch", "[!shouldfail]" ) {
     CHECK(f() == 0);
     REQUIRE(errno == 1); // Check that f() doesn't touch errno.
 }
+
+TEST_CASE( "#961 -- Dynamically created sections should all be reported", "[.]" ) {
+    for (char i = '0'; i < '5'; ++i) {
+        SECTION(std::string("Looped section ") + i) {
+            SUCCEED( "Everything is OK" );
+        }
+    }
+}