extracttests.py: minor code fixes of --code handling
This commit is contained in:
parent
7624313808
commit
16ae2f49ca
|
@ -239,9 +239,12 @@ if filename != None:
|
||||||
|
|
||||||
functionName = node['functionName']
|
functionName = node['functionName']
|
||||||
code = node['code']
|
code = node['code']
|
||||||
|
code = code.replace('\\n', '\n')
|
||||||
|
code = code.replace('\\"', '"')
|
||||||
expected = node['expected']
|
expected = node['expected']
|
||||||
|
|
||||||
filename = str(testnum) + '-'
|
filename = '0000' + str(testnum) + '-'
|
||||||
|
filename = filename[-4:]
|
||||||
filename += functionName + '.cpp'
|
filename += functionName + '.cpp'
|
||||||
|
|
||||||
# source code
|
# source code
|
||||||
|
@ -249,13 +252,15 @@ if filename != None:
|
||||||
fout.write(code)
|
fout.write(code)
|
||||||
fout.close()
|
fout.close()
|
||||||
|
|
||||||
# suppression
|
# write 'expected' to errors.txt
|
||||||
|
expected = expected.replace('\\n', '\n')
|
||||||
|
expected = expected.replace('\\"', '"')
|
||||||
if expected.startswith('[test.cpp:'):
|
if expected.startswith('[test.cpp:'):
|
||||||
expected='['+filename+expected[10:]
|
expected='['+filename+expected[9:]
|
||||||
elif expected.startswith('[test.c:'):
|
elif expected.startswith('[test.c:'):
|
||||||
expected='['+filename+expected[8:]
|
expected='['+filename+expected[8:]
|
||||||
if expected != '':
|
if expected != '':
|
||||||
errors.write(expected+'\n')
|
errors.write(expected)
|
||||||
errors.close()
|
errors.close()
|
||||||
else:
|
else:
|
||||||
for node in e.nodes:
|
for node in e.nodes:
|
||||||
|
|
Loading…
Reference in New Issue