changeset 12934:ea7ad8c3988a stable

tests: handle .t files without trailing LF 9a2de8dae27b made this simple test-test.t succeed silently: $ printf ' $ true' > test-test.t but did not give a usable .err in this case: $ printf ' $ false' > test-test.t The missing LF will now be fixed in the test output and it will thus give a test failure and a solution in the .err file.
author Mads Kiilerich <mads@kiilerich.com>
date Sat, 06 Nov 2010 00:31:44 +0100
parents ab93029ab622
children 518dd70d1a6e
files tests/run-tests.py tests/test-qrecord.t
diffstat 2 files changed, 2 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/tests/run-tests.py	Fri Nov 05 15:54:32 2010 -0400
+++ b/tests/run-tests.py	Sat Nov 06 00:31:44 2010 +0100
@@ -464,6 +464,8 @@
     after = {}
     expected = {}
     for n, l in enumerate(t):
+        if not l.endswith('\n'):
+            l += '\n'
         if l.startswith('  $ '): # commands
             after.setdefault(pos, []).append(l)
             prepos = pos
@@ -480,8 +482,6 @@
             # non-command/result - queue up for merged output
             after.setdefault(pos, []).append(l)
 
-    if script and not script[-1].endswith('\n'):
-        script[-1] = script[-1] + '\n'
     script.append('echo %s %s $?\n' % (salt, n + 1))
 
     fd, name = tempfile.mkstemp(suffix='hg-tst')
--- a/tests/test-qrecord.t	Fri Nov 05 15:54:32 2010 -0400
+++ b/tests/test-qrecord.t	Sat Nov 06 00:31:44 2010 +0100
@@ -302,5 +302,3 @@
 After qrecord b.patch 'diff'
 
   $ hg diff --nodates
-
-End
\ No newline at end of file