[PATCH 1 of 5] run-tests: improve readability, check for empty line separately

Simon Heimberg simohe at besonet.ch
Fri Oct 12 11:43:20 CDT 2012


# HG changeset patch
# User Simon Heimberg <simohe at besonet.ch>
# Date 1350059450 -7200
# Node ID 02b74c548336c6bfb6f8c8506567826fc535131d
# Parent  4cc847f2bb2b6fbec3fecbe483742307e418c114
run-tests: improve readability, check for empty line separately

diff -r 4cc847f2bb2b -r 02b74c548336 tests/run-tests.py
--- a/tests/run-tests.py	Fre Okt 12 16:49:23 2012 +0200
+++ b/tests/run-tests.py	Fre Okt 12 18:30:50 2012 +0200
@@ -539,13 +539,14 @@
 def linematch(el, l):
     if el == l: # perfect match (fast)
         return True
-    if (el and
-        (el.endswith(" (re)\n") and rematch(el[:-6] + '\n', l) or
+    if not el:
+        return False
+    if el.endswith(" (re)\n") and rematch(el[:-6] + '\n', l) or
          el.endswith(" (glob)\n") and globmatch(el[:-8] + '\n', l) or
          el.endswith(" (esc)\n") and
              (el[:-7].decode('string-escape') + '\n' == l or
               el[:-7].decode('string-escape').replace('\r', '') +
-                  '\n' == l and os.name == 'nt'))):
+                  '\n' == l and os.name == 'nt')):
         return True
     return False
 


More information about the Mercurial-devel mailing list