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

Force disable console colours for tests that regex check output

Fixes #2458
Commit
338e4ec1f8dc33f1f55ba1ab85b4ae73d0ffa65e
Author
Martin Hořeňovský ·
Parents
372b7575f67a

Files · Download .tar.gz

Changes

 tests/CMakeLists.txt           | 4 ++++
 tools/scripts/approvalTests.py | 8 ++++----
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index af4ca28e..d029e05d 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -311,6 +311,7 @@ add_test(
     $<TARGET_FILE:SelfTest> "#2025: same-level sections"
     -c "A"
     -c "B"
+    --colour-mode none
 )
 set_tests_properties(FilteredSection::GeneratorsDontCauseInfiniteLoop-2
   PROPERTIES
@@ -394,6 +395,7 @@ add_test(NAME "Benchmarking::SkipBenchmarkMacros"
     $<TARGET_FILE:SelfTest> "Skip benchmark macros"
       --reporter console
       --skip-benchmarks
+      --colour-mode none
 )
 set_tests_properties("Benchmarking::SkipBenchmarkMacros"
   PROPERTIES
@@ -501,6 +503,7 @@ add_test(NAME "Outputs::DashAsOutLocationSendsOutputToStdout"
   COMMAND
     $<TARGET_FILE:SelfTest> "Factorials are computed"
       --out=-
+      --colour-mode none
 )
 set_tests_properties("Outputs::DashAsOutLocationSendsOutputToStdout"
   PROPERTIES
@@ -511,6 +514,7 @@ add_test(NAME "Reporters::DashAsLocationInReporterSpecSendsOutputToStdout"
   COMMAND
     $<TARGET_FILE:SelfTest> "Factorials are computed"
       --reporter console::out=-
+      --colour-mode none
 )
 set_tests_properties("Reporters::DashAsLocationInReporterSpecSendsOutputToStdout"
   PROPERTIES
diff --git a/tools/scripts/approvalTests.py b/tools/scripts/approvalTests.py
index fbe5b0d6..3bd9c23f 100755
--- a/tools/scripts/approvalTests.py
+++ b/tools/scripts/approvalTests.py
@@ -202,21 +202,21 @@ print("  " + cmdPath)
 
 ## special cases first:
 # Standard console reporter
-approve("console.std", ["~[!nonportable]~[!benchmark]~[approvals] *", "--order", "lex", "--rng-seed", "1"])
+approve("console.std", ["~[!nonportable]~[!benchmark]~[approvals] *", "--order", "lex", "--rng-seed", "1", "--colour-mode", "none"])
 # console reporter, include passes, warn about No Assertions, limit failures to first 4
-approve("console.swa4", ["~[!nonportable]~[!benchmark]~[approvals] *", "-s", "-w", "NoAssertions", "-x", "4", "--order", "lex", "--rng-seed", "1"])
+approve("console.swa4", ["~[!nonportable]~[!benchmark]~[approvals] *", "-s", "-w", "NoAssertions", "-x", "4", "--order", "lex", "--rng-seed", "1", "--colour-mode", "none"])
 
 ## Common reporter checks: include passes, warn about No Assertions
 reporters = ('console', 'junit', 'xml', 'compact', 'sonarqube', 'tap', 'teamcity', 'automake')
 for reporter in reporters:
     filename = '{}.sw'.format(reporter)
-    common_args = ["~[!nonportable]~[!benchmark]~[approvals] *", "-s", "-w", "NoAssertions", "--order", "lex", "--rng-seed", "1"]
+    common_args = ["~[!nonportable]~[!benchmark]~[approvals] *", "-s", "-w", "NoAssertions", "--order", "lex", "--rng-seed", "1", "--colour-mode", "none"]
     reporter_args = ['-r', reporter]
     approve(filename, common_args + reporter_args)
 
 ## All reporters at the same time
 
-common_args = ["~[!nonportable]~[!benchmark]~[approvals] *", "-s", "-w", "NoAssertions", "--order", "lex", "--rng-seed", "1"]
+common_args = ["~[!nonportable]~[!benchmark]~[approvals] *", "-s", "-w", "NoAssertions", "--order", "lex", "--rng-seed", "1", "--colour-mode", "none"]
 filenames = ['{}.sw.multi'.format(reporter) for reporter in reporters]
 reporter_args = []
 for reporter, filename in zip(reporters, filenames):