Skip to content

Commit

Permalink
Add test to assert grad error handling support claimed in #11
Browse files Browse the repository at this point in the history
  • Loading branch information
baileyparker committed Feb 20, 2018
1 parent 5f38278 commit c39cf9c
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion tests/simple_test/phase_test_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ def test_tests_pass_for_dummy_compiler(self):
for fixture in fixtures:
self.assertGoodFakeCompilerPasses(fake_compiler, fixture)

if fixture.phase_file.has_error:
self.assertMultipleErrorsPasses(fake_compiler, fixture)

for for_stdin in (False, True):
self.assertBadStdoutFakeCompilerFails(fake_compiler,
fixture, for_stdin)
Expand All @@ -45,7 +48,17 @@ def test_tests_pass_for_dummy_compiler(self):
def assertGoodFakeCompilerPasses(self, fake_compiler, fixture):
phase_file = fixture.phase_file

stderr = 'error: \n' if phase_file.has_error else ''
stderr = 'error: blah blah\n' if phase_file.has_error else ''
self.run_fake_compiler(fake_compiler, fixture, (phase_file.stdout,
stderr))

self.assertFakeCompilerHasCalls(fake_compiler, fixture)

def assertMultipleErrorsPasses(self, fake_compiler, fixture):
phase_file = fixture.phase_file
assert phase_file.has_error, 'should only be called for error fixtures'

stderr = 'error: foo bar\nerror: baz blah'
self.run_fake_compiler(fake_compiler, fixture, (phase_file.stdout,
stderr))

Expand Down

0 comments on commit c39cf9c

Please sign in to comment.