mirror of
https://github.com/catchorg/Catch2.git
synced 2024-11-22 21:36:11 +01:00
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.
This commit is contained in:
parent
e641485132
commit
98e61c31df
@ -52,9 +52,9 @@ overallResult = 0
|
|||||||
|
|
||||||
def diffFiles(fileA, fileB):
|
def diffFiles(fileA, fileB):
|
||||||
with open(fileA, 'r') as file:
|
with open(fileA, 'r') as file:
|
||||||
aLines = file.readlines()
|
aLines = [line.rstrip() for line in file.readlines()]
|
||||||
with open(fileB, 'r') as file:
|
with open(fileB, 'r') as file:
|
||||||
bLines = file.readlines()
|
bLines = [line.rstrip() for line in file.readlines()]
|
||||||
|
|
||||||
shortenedFilenameA = fileA.rsplit(os.sep, 1)[-1]
|
shortenedFilenameA = fileA.rsplit(os.sep, 1)[-1]
|
||||||
shortenedFilenameB = fileB.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):
|
if os.path.exists(baselinesPath):
|
||||||
diffResult = diffFiles(baselinesPath, filteredResultsPath)
|
diffResult = diffFiles(baselinesPath, filteredResultsPath)
|
||||||
if diffResult:
|
if diffResult:
|
||||||
print(''.join(diffResult))
|
print('\n'.join(diffResult))
|
||||||
print(" \n****************************\n \033[91mResults differed")
|
print(" \n****************************\n \033[91mResults differed")
|
||||||
if len(diffResult) > overallResult:
|
if len(diffResult) > overallResult:
|
||||||
overallResult = len(diffResult)
|
overallResult = len(diffResult)
|
||||||
|
Loading…
Reference in New Issue
Block a user