Skip to content

Commit

Permalink
Normalize approval paths for both backward and forward slash as path sep
Browse files Browse the repository at this point in the history
  • Loading branch information
horenmar committed Nov 12, 2021
1 parent 9200b40 commit 83d9a63
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions tools/scripts/approvalTests.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 83d9a63

Please sign in to comment.