Read-only mirrors. Development, issues and pull requests are on GitHub.

summaryrefslogtreecommitdiffhomepage
path: root/tools/scripts/approvalTests.py
diff options
context:
space:
mode:
authorMartin Hořeňovský2021-11-12 23:51:51 +0100
committerMartin Hořeňovský2021-11-13 22:10:25 +0100
commitc4df47c2465ffecc5efc10420b5b36fc8e36990f (patch)
treeec0147847e9544e048d0fba21b4d8cc31a0fecde /tools/scripts/approvalTests.py
parent9200b4078bcec238b0ebe9f60d31ae02693c4e23 (diff)
downloadcatch3-c4df47c2465ffecc5efc10420b5b36fc8e36990f.tar.gz
Approvals normalize paths with both backward and forward slash
Diffstat (limited to 'tools/scripts/approvalTests.py')
-rwxr-xr-xtools/scripts/approvalTests.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/tools/scripts/approvalTests.py b/tools/scripts/approvalTests.py
index 1bef3e52..99b94152 100755
--- a/tools/scripts/approvalTests.py
+++ b/tools/scripts/approvalTests.py
@@ -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: