mirror of
https://github.com/catchorg/Catch2.git
synced 2025-08-01 21:05:39 +02:00
Refactor some common code, use __LINE__ instead of __COUNTER__ where possible
This commit is contained in:
@@ -134,7 +134,14 @@ class TestConditionData:
|
||||
if not(reasonOnSameLine) and len(self.reason):
|
||||
lines.append(self.reason)
|
||||
if len(self.condition):
|
||||
lines.append(" " + self.condition)
|
||||
line = self.condition
|
||||
m = self.hexParser.match(line)
|
||||
if m:
|
||||
while m:
|
||||
line = m.group(1) + "0x<hex digits>" + m.group(3)
|
||||
m = self.hexParser.match(line)
|
||||
line = line.replace("__null","0")
|
||||
lines.append(" " + line)
|
||||
if len(self.expansionPrefix):
|
||||
lines.append(self.expansionPrefix)
|
||||
extraLine = True
|
||||
@@ -145,6 +152,7 @@ class TestConditionData:
|
||||
while m:
|
||||
line = m.group(1) + "0x<hex digits>" + m.group(3)
|
||||
m = self.hexParser.match(line)
|
||||
line = line.replace("__null","0")
|
||||
lines.append(" " + line)
|
||||
if len(self.messagePrefix):
|
||||
lines.append(self.messagePrefix)
|
||||
@@ -223,7 +231,14 @@ class TestConditionData:
|
||||
if not(reasonOnSameLine) and len(self.reason):
|
||||
lines.append(self.reason)
|
||||
if len(self.condition):
|
||||
lines.append(" " + self.condition)
|
||||
line = self.condition
|
||||
m = self.hexParser.match(line)
|
||||
if m:
|
||||
while m:
|
||||
line = m.group(1) + "0x<hex digits>" + m.group(3)
|
||||
m = self.hexParser.match(line)
|
||||
line = line.replace("Catch::Text","Text")
|
||||
lines.append(" " + line)
|
||||
if len(self.expansionPrefix):
|
||||
lines.append(self.expansionPrefix)
|
||||
extraLine = True
|
||||
|
@@ -44,8 +44,8 @@ def approve( baseName, args ):
|
||||
rawResultsPath = os.path.join( rootPath, '_{0}.tmp'.format( baseName ) )
|
||||
if os.path.exists( baselinesPath ):
|
||||
approvedFileHandler = TestRunApprovedHandler(baselinesPath)
|
||||
baselinesPathNew = os.path.join( rootPath, '{0}.approved.new.txt'.format( baseName ) )
|
||||
approvedFileHandler.writeRawFile(baselinesPathNew)
|
||||
#baselinesPathNew = os.path.join( rootPath, '{0}.approved.new.txt'.format( baseName ) )
|
||||
#approvedFileHandler.writeRawFile(baselinesPathNew)
|
||||
approvedFileHandler.writeSortedRawFile(baselinesSortedPath)
|
||||
else:
|
||||
raise Exception("Base file does not exist: '" + baselinesPath + "'")
|
||||
@@ -59,11 +59,12 @@ def approve( baseName, args ):
|
||||
|
||||
if os.path.exists( rawResultsPath ):
|
||||
resultFileHandler = TestRunResultHandler(rawResultsPath)
|
||||
rawPathNew = os.path.join( rootPath, '{0}.rewrite.txt'.format( baseName ) )
|
||||
#rawPathNew = os.path.join( rootPath, '{0}.rewrite.txt'.format( baseName ) )
|
||||
#print "F:",rawPathNew,",",approvedFileHandler.current.outputLine
|
||||
resultFileHandler.writeRawFile(rawPathNew)
|
||||
#resultFileHandler.writeRawFile(rawPathNew)
|
||||
rawPathNewSorted = os.path.join( rootPath, '{0}.sorted.unapproved.txt'.format( baseName ) )
|
||||
resultFileHandler.writeSortedUnapprovedFile(rawPathNewSorted, approvedFileHandler.current.outputLine)
|
||||
os.remove( rawResultsPath )
|
||||
else:
|
||||
raise Exception("Results file does not exist: '" + rawResultsPath + "'")
|
||||
|
||||
|
Reference in New Issue
Block a user