Read-only mirrors. Development, issues and pull requests are on GitHub.

summaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorPhilip Salzmann2022-10-24 14:17:15 +0200
committerMartin Hořeňovský2022-10-25 20:02:26 +0200
commit6185d0cc0a737d5a009f626d3611b868512d12f7 (patch)
tree6f190d9cbd5c667cb68282e263e77e67706e76f9 /tests
parent8ce92d2c7288b6b3261caf1c016f8a779b6a8efc (diff)
downloadcatch3-6185d0cc0a737d5a009f626d3611b868512d12f7.tar.gz
Use console reporter's totals summary for compact reporter
This changes the compact reporter's summary of test run totals to use the same format as the console reporter. This means that while output is no longer on a single line (two instead), it now includes totals for `failedButOk` test cases and assertions, which were previously missing.
Diffstat (limited to 'tests')
-rw-r--r--tests/CMakeLists.txt2
-rw-r--r--tests/ExtraTests/CMakeLists.txt2
-rw-r--r--tests/SelfTest/Baselines/compact.sw.approved.txt4
-rw-r--r--tests/SelfTest/Baselines/compact.sw.multi.approved.txt4
-rw-r--r--tests/TestScripts/testConfigureDefaultReporter.py11
5 files changed, 12 insertions, 11 deletions
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index 0dca91e8..666ecfff 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -336,7 +336,7 @@ set_tests_properties(ApprovalTests
)
add_test(NAME RegressionCheck-1670 COMMAND $<TARGET_FILE:SelfTest> "#1670 regression check" -c A -r compact)
-set_tests_properties(RegressionCheck-1670 PROPERTIES PASS_REGULAR_EXPRESSION "Passed 1 test case with 2 assertions.")
+set_tests_properties(RegressionCheck-1670 PROPERTIES PASS_REGULAR_EXPRESSION "All tests passed \\(2 assertions in 1 test case\\)")
add_test(NAME VersionCheck COMMAND $<TARGET_FILE:SelfTest> -h)
set_tests_properties(VersionCheck PROPERTIES PASS_REGULAR_EXPRESSION "Catch2 v${PROJECT_VERSION}")
diff --git a/tests/ExtraTests/CMakeLists.txt b/tests/ExtraTests/CMakeLists.txt
index a714b230..c821f9f0 100644
--- a/tests/ExtraTests/CMakeLists.txt
+++ b/tests/ExtraTests/CMakeLists.txt
@@ -210,7 +210,7 @@ add_test(NAME DeferredStaticChecks COMMAND DeferredStaticChecks -r compact)
set_tests_properties(
DeferredStaticChecks
PROPERTIES
- PASS_REGULAR_EXPRESSION "Failed 1 test case, failed all 3 assertions."
+ PASS_REGULAR_EXPRESSION "test cases: 1 \\| 1 failed\nassertions: 3 \\| 3 failed"
)
diff --git a/tests/SelfTest/Baselines/compact.sw.approved.txt b/tests/SelfTest/Baselines/compact.sw.approved.txt
index 0a023565..0f62c31f 100644
--- a/tests/SelfTest/Baselines/compact.sw.approved.txt
+++ b/tests/SelfTest/Baselines/compact.sw.approved.txt
@@ -2610,5 +2610,7 @@ InternalBenchmark.tests.cpp:<line number>: passed: med == 18. for: 18.0 == 18.0
InternalBenchmark.tests.cpp:<line number>: passed: q3 == 23. for: 23.0 == 23.0
Misc.tests.cpp:<line number>: passed:
Misc.tests.cpp:<line number>: passed:
-Failed 83 test cases, failed 143 assertions.
+test cases: 395 | 305 passed | 83 failed | 7 failed as expected
+assertions: 2310 | 2140 passed | 143 failed | 27 failed as expected
+
diff --git a/tests/SelfTest/Baselines/compact.sw.multi.approved.txt b/tests/SelfTest/Baselines/compact.sw.multi.approved.txt
index 20d14da1..794af3a5 100644
--- a/tests/SelfTest/Baselines/compact.sw.multi.approved.txt
+++ b/tests/SelfTest/Baselines/compact.sw.multi.approved.txt
@@ -2602,5 +2602,7 @@ InternalBenchmark.tests.cpp:<line number>: passed: med == 18. for: 18.0 == 18.0
InternalBenchmark.tests.cpp:<line number>: passed: q3 == 23. for: 23.0 == 23.0
Misc.tests.cpp:<line number>: passed:
Misc.tests.cpp:<line number>: passed:
-Failed 83 test cases, failed 143 assertions.
+test cases: 395 | 305 passed | 83 failed | 7 failed as expected
+assertions: 2310 | 2140 passed | 143 failed | 27 failed as expected
+
diff --git a/tests/TestScripts/testConfigureDefaultReporter.py b/tests/TestScripts/testConfigureDefaultReporter.py
index 66c88da0..b10bd528 100644
--- a/tests/TestScripts/testConfigureDefaultReporter.py
+++ b/tests/TestScripts/testConfigureDefaultReporter.py
@@ -30,15 +30,12 @@ build_dir_path = os.path.join(os.path.abspath(sys.argv[2]), 'CMakeConfigTests',
configure_and_build(catch2_source_path,
build_dir_path,
- [("CATCH_CONFIG_DEFAULT_REPORTER", "compact")])
+ [("CATCH_CONFIG_DEFAULT_REPORTER", "xml")])
stdout, _ = run_and_return_output(os.path.join(build_dir_path, 'tests'), 'SelfTest', ['[approx][custom]'])
-
-# This matches the summary line made by compact reporter, console reporter's
-# summary line does not match the regex.
-summary_regex = 'Passed \d+ test case with \d+ assertions.'
-if not re.search(summary_regex, stdout):
- print("Could not find '{}' in the stdout".format(summary_regex))
+xml_tag = '</Catch2TestRun>'
+if xml_tag not in stdout:
+ print("Could not find '{}' in the stdout".format(xml_tag))
print('stdout: "{}"'.format(stdout))
exit(2)