MCPcopy Create free account
hub / github.com/catchorg/Catch2 / diffFiles

Function diffFiles

tools/scripts/approvalTests.py:83–93  ·  view source on GitHub ↗
(fileA, fileB)

Source from the content-addressed store, hash-verified

81overallResult = 0
82
83def diffFiles(fileA, fileB):
84 with io.open(fileA, 'r', encoding='utf-8', errors='surrogateescape') as file:
85 aLines = [line.rstrip() for line in file.readlines()]
86 with io.open(fileB, 'r', encoding='utf-8', errors='surrogateescape') as file:
87 bLines = [line.rstrip() for line in file.readlines()]
88
89 shortenedFilenameA = fileA.rsplit(os.sep, 1)[-1]
90 shortenedFilenameB = fileB.rsplit(os.sep, 1)[-1]
91
92 diff = difflib.unified_diff(aLines, bLines, fromfile=shortenedFilenameA, tofile=shortenedFilenameB, n=0)
93 return [line for line in diff if line[0] in ('+', '-')]
94
95
96def normalizeFilepath(line):

Callers 1

check_outputsFunction · 0.85

Calls 1

openMethod · 0.45

Tested by

no test coverage detected