Merge pull request #717 from juj/test_compile_fail

Ensure that a failing compilation results in a nonzero return code.
This commit is contained in:
Alon Zakai 2012-11-23 08:25:54 -08:00
Родитель fc56ff9c04 472c9d3271
Коммит 16eda852f5
1 изменённых файлов: 3 добавлений и 1 удалений

Просмотреть файл

@ -7448,9 +7448,11 @@ Options that are modified or new in %s include:
# properly report source code errors, and stop there
self.clear()
assert not os.path.exists('a.out.js')
output = Popen(['python', compiler, path_from_root('tests', 'hello_world_error' + suffix)], stdout=PIPE, stderr=PIPE).communicate()
process = Popen(['python', compiler, path_from_root('tests', 'hello_world_error' + suffix)], stdout=PIPE, stderr=PIPE)
output = process.communicate()
assert not os.path.exists('a.out.js'), 'compilation failed, so no output file is expected'
assert len(output[0]) == 0, output[0]
assert process.returncode is not 0, 'Failed compilation must return a nonzero error code!'
self.assertNotContained('IOError', output[1]) # no python stack
self.assertNotContained('Traceback', output[1]) # no python stack
self.assertContained('error: invalid preprocessing directive', output[1])