diff options
author | Thomas Miedema <thomasmiedema@gmail.com> | 2016-02-23 21:29:59 +0100 |
---|---|---|
committer | Thomas Miedema <thomasmiedema@gmail.com> | 2016-02-25 23:26:06 +0100 |
commit | 1badf157be3b7f604ba1ac64d2ea044d783e6e50 (patch) | |
tree | b2b53efb44819c7a47800cd5b03ec40a27e73aba | |
parent | 9b49c65fe696b7a24f3858e3f23e1d73f9b92a21 (diff) | |
download | haskell-1badf157be3b7f604ba1ac64d2ea044d783e6e50.tar.gz |
Testsuite: do not write empty files on 'make accept'
Also prevent showing '\ No newline at end of file' in diff output.
-rw-r--r-- | testsuite/driver/testlib.py | 12 | ||||
-rw-r--r-- | testsuite/tests/typecheck/should_compile/tc162.stderr | 0 |
2 files changed, 10 insertions, 2 deletions
diff --git a/testsuite/driver/testlib.py b/testsuite/driver/testlib.py index 1ebe6a7565..2a9f141b59 100644 --- a/testsuite/driver/testlib.py +++ b/testsuite/driver/testlib.py @@ -1647,10 +1647,14 @@ def compare_outputs(way, kind, normaliser, expected_file, actual_file, way in getTestOpts().expect_fail_for): if_verbose(1, 'Test is expected to fail. Not accepting new output.') return 0 - elif config.accept: + elif config.accept and actual_raw: if_verbose(1, 'Accepting new output.') write_file(expected_path, actual_raw) return 1 + elif config.accept: + if_verbose(1, 'No output. Deleting {0}.'.format(expected_path)) + rm_no_fail(expected_path) + return 1 else: return 0 @@ -2306,4 +2310,8 @@ def printFailingTestInfosSummary(file, testInfos): file.write('\n') def modify_lines(s, f): - return '\n'.join([f(l) for l in s.splitlines()]) + s = '\n'.join([f(l) for l in s.splitlines()]) + if s and s[-1] != '\n': + # Prevent '\ No newline at end of file' warnings when diffing. + s += '\n' + return s diff --git a/testsuite/tests/typecheck/should_compile/tc162.stderr b/testsuite/tests/typecheck/should_compile/tc162.stderr deleted file mode 100644 index e69de29bb2..0000000000 --- a/testsuite/tests/typecheck/should_compile/tc162.stderr +++ /dev/null |