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

Approval tests now see different line endings as ok

This is mostly to deal with WSL, where git will checkout file with CRLF,
but code that uses formatted output will be writing LFs.
Commit
98e61c31dfee09337a77234443e10cf29778975a
Author
Martin Hořeňovský ·
Parents
e6414851321c

Files · Download .tar.gz

Changes

 scripts/approvalTests.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/scripts/approvalTests.py b/scripts/approvalTests.py
index 0b0d036c..3b71be3e 100755
--- a/scripts/approvalTests.py
+++ b/scripts/approvalTests.py
@@ -52,9 +52,9 @@ overallResult = 0
 
 def diffFiles(fileA, fileB):
     with open(fileA, 'r') as file:
-        aLines = file.readlines()
+        aLines = [line.rstrip() for line in file.readlines()]
     with open(fileB, 'r') as file:
-        bLines = file.readlines()
+        bLines = [line.rstrip() for line in file.readlines()]
 
     shortenedFilenameA = fileA.rsplit(os.sep, 1)[-1]
     shortenedFilenameB = fileB.rsplit(os.sep, 1)[-1]
@@ -127,7 +127,7 @@ def approve(baseName, args):
     if os.path.exists(baselinesPath):
         diffResult = diffFiles(baselinesPath, filteredResultsPath)
         if diffResult:
-            print(''.join(diffResult))
+            print('\n'.join(diffResult))
             print("  \n****************************\n  \033[91mResults differed")
             if len(diffResult) > overallResult:
                 overallResult = len(diffResult)