mirror of
https://github.com/catchorg/Catch2.git
synced 2024-11-25 23:06:10 +01:00
Normalize OS X specific pass/fail strings in approvals
This commit is contained in:
parent
7abd7db2c8
commit
2771a8ee9a
@ -91,7 +91,7 @@ def diffFiles(fileA, fileB):
|
|||||||
return [line for line in diff if line[0] in ('+', '-')]
|
return [line for line in diff if line[0] in ('+', '-')]
|
||||||
|
|
||||||
|
|
||||||
def filterLine(line):
|
def filterLine(line, isCompact):
|
||||||
if catchPath in line:
|
if catchPath in line:
|
||||||
# make paths relative to Catch root
|
# make paths relative to Catch root
|
||||||
line = line.replace(catchPath + os.sep, '')
|
line = line.replace(catchPath + os.sep, '')
|
||||||
@ -109,6 +109,10 @@ def filterLine(line):
|
|||||||
else:
|
else:
|
||||||
line = lineNumberParser.sub(" ", line)
|
line = lineNumberParser.sub(" ", line)
|
||||||
|
|
||||||
|
if isCompact:
|
||||||
|
line = line.replace(': FAILED', ': failed')
|
||||||
|
line = line.replace(': PASSED', ': passed')
|
||||||
|
|
||||||
# strip Catch version number
|
# strip Catch version number
|
||||||
line = versionParser.sub("<version>", line)
|
line = versionParser.sub("<version>", line)
|
||||||
|
|
||||||
@ -148,7 +152,7 @@ def approve(baseName, args):
|
|||||||
rawFile = io.open(rawResultsPath, 'r', encoding='utf-8', errors='surrogateescape')
|
rawFile = io.open(rawResultsPath, 'r', encoding='utf-8', errors='surrogateescape')
|
||||||
filteredFile = io.open(filteredResultsPath, 'w', encoding='utf-8', errors='surrogateescape')
|
filteredFile = io.open(filteredResultsPath, 'w', encoding='utf-8', errors='surrogateescape')
|
||||||
for line in rawFile:
|
for line in rawFile:
|
||||||
filteredFile.write(filterLine(line).rstrip() + "\n")
|
filteredFile.write(filterLine(line, 'compact' in baseName).rstrip() + "\n")
|
||||||
filteredFile.close()
|
filteredFile.close()
|
||||||
rawFile.close()
|
rawFile.close()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user