tests/run-tests.py
branchstable
changeset 1149 a3d0e19724c3
parent 1143 38b7bb8f1c85
child 1150 feb29f7d0066
--- a/tests/run-tests.py	Thu Oct 18 22:12:15 2012 +0200
+++ b/tests/run-tests.py	Mon Oct 15 02:33:12 2012 +0200
@@ -494,8 +494,10 @@
 
 def rematch(el, l):
     try:
-        # ensure that the regex matches to the end of the string
-        return re.match(el + r'\Z', l)
+        # use \Z to ensure that the regex matches to the end of the string
+        if os.name == 'nt':
+            return re.match(el + r'\r?\n\Z', l)
+        return re.match(el + r'\n\Z', l)
     except re.error:
         # el is an invalid regex
         return False
@@ -525,12 +527,12 @@
     if el == l: # perfect match (fast)
         return True
     if (el and
-        (el.endswith(" (re)\n") and rematch(el[:-6] + '\n', l) or
-         el.endswith(" (glob)\n") and globmatch(el[:-8] + '\n', l) or
+        (el.endswith(" (re)\n") and rematch(el[:-6], l) or
+         el.endswith(" (glob)\n") and globmatch(el[:-8], 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'))):
+              os.name == 'nt' and
+              el[:-7].decode('string-escape') + '\n' == l))):
         return True
     return False
 
@@ -885,7 +887,6 @@
         (r':%s\b' % (options.port + 2), ':$HGPORT2'),
         ]
     if os.name == 'nt':
-        replacements.append((r'\r\n', '\n'))
         replacements.append(
             (''.join(c.isalpha() and '[%s%s]' % (c.lower(), c.upper()) or
                      c in '/\\' and r'[/\\]' or