Approvals normalize paths with both backward and forward slash

This commit is contained in:
Martin Hořeňovský 2021-11-12 23:51:51 +01:00
parent 9200b4078b
commit c4df47c246
No known key found for this signature in database
GPG Key ID: DE48307B8B0D381A

View File

@ -99,9 +99,15 @@ def diffFiles(fileA, fileB):
def normalizeFilepath(line):
if catchPath in line:
# make paths relative to Catch root
line = line.replace(catchPath + os.sep, '')
# Sometimes the path separators used by compiler and Python can differ,
# so we try to match the path with both forward and backward path
# separators, to make the paths relative to Catch2 repo root.
forwardSlashPath = catchPath.replace('\\', '/')
if forwardSlashPath in line:
line = line.replace(forwardSlashPath + '/', '')
backwardSlashPath = catchPath.replace('/', '\\')
if backwardSlashPath in line:
line = line.replace(backwardSlashPath + '\\', '')
m = langFilenameParser.match(line)
if m: