extracttests.py: minor code fixes of --code handling

This commit is contained in:
Daniel Marjamäki 2011-11-29 10:13:37 +01:00
parent 7624313808
commit 16ae2f49ca
1 changed files with 9 additions and 4 deletions

View File

@ -239,9 +239,12 @@ if filename != None:
functionName = node['functionName']
code = node['code']
code = code.replace('\\n', '\n')
code = code.replace('\\"', '"')
expected = node['expected']
filename = str(testnum) + '-'
filename = '0000' + str(testnum) + '-'
filename = filename[-4:]
filename += functionName + '.cpp'
# source code
@ -249,13 +252,15 @@ if filename != None:
fout.write(code)
fout.close()
# suppression
# write 'expected' to errors.txt
expected = expected.replace('\\n', '\n')
expected = expected.replace('\\"', '"')
if expected.startswith('[test.cpp:'):
expected='['+filename+expected[10:]
expected='['+filename+expected[9:]
elif expected.startswith('[test.c:'):
expected='['+filename+expected[8:]
if expected != '':
errors.write(expected+'\n')
errors.write(expected)
errors.close()
else:
for node in e.nodes: