Add ability to test

pull/110/head
Craig Tiller 10 years ago
parent cf1d6eb4ae
commit d4eeff8a2d
  1. 11
      tools/buildgen/build-cleaner.py

@ -6,6 +6,8 @@ import json
import os import os
import sys import sys
TEST = (os.environ.get('TEST', 'false') == 'true')
_TOP_LEVEL_KEYS = ['settings', 'filegroups', 'libs', 'targets'] _TOP_LEVEL_KEYS = ['settings', 'filegroups', 'libs', 'targets']
_VERSION_KEYS = ['major', 'minor', 'micro', 'build'] _VERSION_KEYS = ['major', 'minor', 'micro', 'build']
_ELEM_KEYS = [ _ELEM_KEYS = [
@ -51,6 +53,11 @@ for filename in sys.argv[1:]:
lines = [] lines = []
for line in output.splitlines(): for line in output.splitlines():
lines.append(line.rstrip() + '\n') lines.append(line.rstrip() + '\n')
with open(filename, 'w') as f: output = ''.join(lines)
f.write(''.join(lines)) if TEST:
with open(filename) as f:
assert f.read() == output
else:
with open(filename, 'w') as f:
f.write(output)

Loading…
Cancel
Save