[commit: ghc] master: Testsuite: do not write empty files on 'make accept' (1badf15)
git at git.haskell.org
git at git.haskell.org
Thu Feb 25 22:24:42 UTC 2016
Repository : ssh://git@git.haskell.org/ghc
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/1badf157be3b7f604ba1ac64d2ea044d783e6e50/ghc
>---------------------------------------------------------------
commit 1badf157be3b7f604ba1ac64d2ea044d783e6e50
Author: Thomas Miedema <thomasmiedema at gmail.com>
Date: Tue Feb 23 21:29:59 2016 +0100
Testsuite: do not write empty files on 'make accept'
Also prevent showing '\ No newline at end of file' in diff output.
>---------------------------------------------------------------
1badf157be3b7f604ba1ac64d2ea044d783e6e50
testsuite/driver/testlib.py | 12 ++++++++++--
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 1ebe6a7..2a9f141 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 e69de29..0000000
More information about the ghc-commits
mailing list