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
Cherry picked 4f21bb72ff16f82b7fcf7362d683547f412641f4 (Add tests for #961) from master
- Commit
f06ed856d86ceb3457cb88b167570c01d6566cb2- Author
- Martin Hořeňovský ·
- Committer
- Phil Nash
- Parents
0aec06f4c31b
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 4bc5c454..42d62c9c 100644 --- a/projects/SelfTest/Baselines/console.std.approved.txt +++ b/projects/SelfTest/Baselines/console.std.approved.txt @@ -1020,6 +1020,6 @@ with expansion: "{?}" == "1" =============================================================================== -test cases: 181 | 130 passed | 47 failed | 4 failed as expected -assertions: 876 | 759 passed | 96 failed | 21 failed as expected +test cases: 182 | 131 passed | 47 failed | 4 failed as expected +assertions: 881 | 764 passed | 96 failed | 21 failed as expected diff --git a/projects/SelfTest/Baselines/console.sw.approved.txt b/projects/SelfTest/Baselines/console.sw.approved.txt index 17b876ea..1d228de6 100644 --- a/projects/SelfTest/Baselines/console.sw.approved.txt +++ b/projects/SelfTest/Baselines/console.sw.approved.txt @@ -137,6 +137,66 @@ with expansion: with message: dummy := 0 +------------------------------------------------------------------------------- +#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 ------------------------------------------------------------------------------- @@ -7463,6 +7523,6 @@ MiscTests.cpp:<line number>: PASSED: =============================================================================== -test cases: 181 | 127 passed | 50 failed | 4 failed as expected -assertions: 878 | 755 passed | 102 failed | 21 failed as expected +test cases: 182 | 128 passed | 50 failed | 4 failed as expected +assertions: 883 | 760 passed | 102 failed | 21 failed as expected diff --git a/projects/SelfTest/Baselines/console.swa4.approved.txt b/projects/SelfTest/Baselines/console.swa4.approved.txt index fe22e2b3..bdacd9cb 100644 --- a/projects/SelfTest/Baselines/console.swa4.approved.txt +++ b/projects/SelfTest/Baselines/console.swa4.approved.txt @@ -137,6 +137,66 @@ with expansion: with message: dummy := 0 +------------------------------------------------------------------------------- +#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 ------------------------------------------------------------------------------- @@ -158,6 +218,6 @@ ConditionTests.cpp:<line number>: FAILED: CHECK_FALSE( true ) =============================================================================== -test cases: 7 | 4 passed | 1 failed | 2 failed as expected -assertions: 19 | 12 passed | 4 failed | 3 failed as expected +test cases: 8 | 5 passed | 1 failed | 2 failed as expected +assertions: 24 | 17 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 88b20529..6e3607a8 100644 --- a/projects/SelfTest/Baselines/junit.sw.approved.txt +++ b/projects/SelfTest/Baselines/junit.sw.approved.txt @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <testsuitesloose text artifact > - <testsuite name="<exe-name>" errors="15" failures="88" tests="879" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}"> + <testsuite name="<exe-name>" errors="15" failures="88" tests="884" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}"> <testcase classname="<exe-name>.global" name="# A test name that starts with a #" time="{duration}"/> <testcase classname="<exe-name>.global" name="#748 - captures with unexpected exceptions/outside assertions" time="{duration}"> <error type="TEST_CASE"> @@ -26,6 +26,11 @@ MiscTests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.global" name="#872" time="{duration}"/> + <testcase classname="<exe-name>.global" name="#961 -- Dynamically created sections should all be reported/Looped section 0" time="{duration}"/> + <testcase classname="<exe-name>.global" name="#961 -- Dynamically created sections should all be reported/Looped section 1" time="{duration}"/> + <testcase classname="<exe-name>.global" name="#961 -- Dynamically created sections should all be reported/Looped section 2" time="{duration}"/> + <testcase classname="<exe-name>.global" name="#961 -- Dynamically created sections should all be reported/Looped section 3" time="{duration}"/> + <testcase classname="<exe-name>.global" name="#961 -- Dynamically created sections should all be reported/Looped section 4" time="{duration}"/> <testcase classname="<exe-name>.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 21c9c9ca..f290b1de 100644 --- a/projects/SelfTest/Baselines/xml.sw.approved.txt +++ b/projects/SelfTest/Baselines/xml.sw.approved.txt @@ -150,6 +150,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> @@ -8258,7 +8276,7 @@ loose text artifact </Section> <OverallResult success="true"/> </TestCase> - <OverallResults successes="755" failures="103" expectedFailures="21"/> + <OverallResults successes="760" failures="103" expectedFailures="21"/> </Group> - <OverallResults successes="755" failures="102" expectedFailures="21"/> + <OverallResults successes="760" failures="102" expectedFailures="21"/> </Catch> diff --git a/projects/SelfTest/MiscTests.cpp b/projects/SelfTest/MiscTests.cpp index 500e876a..e3a9318b 100644 --- a/projects/SelfTest/MiscTests.cpp +++ b/projects/SelfTest/MiscTests.cpp @@ -358,3 +358,11 @@ TEST_CASE( "#835 -- errno should not be touched by Catch", "[.][failing][!should 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" ); + } + } +}