[PATCH 1 of 2] run-tests: handle case when the last text before the salt does not include a line feed

timeless timeless at gmail.com
Wed Oct 20 04:29:13 CDT 2010


# HG changeset patch
# User timeless <timeless at gmail.com>
# Date 1287566801 -10800
# Node ID d5510dd3cd27a940b1d7c9cd5df1ac139da03bdf
# Parent  c3316b6a32198a2a8257691a1233a9231222e503
run-tests: handle case when the last text before the salt does not include a line feed

diff --git a/tests/run-tests.py b/tests/run-tests.py
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -531,15 +531,11 @@ def tsttest(test, options, replacements)
     postout = []
     ret = 0
     for n, l in enumerate(output):
-        if l.startswith(salt):
-            # add on last return code
-            ret = int(l.split()[2])
-            if ret != 0:
-                postout.append("  [%s]\n" % ret)
-            if pos in after:
-                postout += after.pop(pos)
-            pos = int(l.split()[1])
-        else:
+        index = l.find(salt)
+        saltline = ''
+        if index >= 0:
+            l, saltline = l[:index],l[index:]
+        if len(l):
             el = None
             if pos in expected and expected[pos]:
                 el = expected[pos].pop(0)
@@ -554,6 +550,15 @@ def tsttest(test, options, replacements)
                 postout.append("  " + el) # fallback regex/glob match
             else:
                 postout.append("  " + l) # let diff deal with it
+        l = saltline
+        if len(l):
+            # add on last return code
+            ret = int(l.split()[2])
+            if ret != 0:
+                postout.append("  [%s]\n" % ret)
+            if pos in after:
+                postout += after.pop(pos)
+            pos = int(l.split()[1])
 
     if pos in after:
         postout += after.pop(pos)


More information about the Mercurial-devel mailing list