mirror of
https://github.com/catchorg/Catch2.git
synced 2025-08-01 21:05:39 +02:00
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.
This commit is contained in:

committed by
Martin Hořeňovský

parent
8ce92d2c72
commit
6185d0cc0a
@@ -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}")
|
||||
|
@@ -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"
|
||||
)
|
||||
|
||||
|
||||
|
@@ -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
|
||||
|
||||
|
||||
|
@@ -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
|
||||
|
||||
|
||||
|
@@ -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)
|
||||
|
Reference in New Issue
Block a user