run-tests: generally handle line endings on windows by re stable
authorSimon Heimberg <simohe@besonet.ch>
Sat, 13 Jul 2013 23:58:01 +0200
branchstable
changeset 1285 61dfbdf6d67d
parent 1284 3f370565e291
child 1286 545a2ae04b54
run-tests: generally handle line endings on windows by re Recently this regexp was only appended when running a python test. When running a tsttest there was a separate handling for each line type. Simplify and unify this. [ original upstream message ]
tests/run-tests.py
--- a/tests/run-tests.py	Sat Jul 13 23:57:55 2013 +0200
+++ b/tests/run-tests.py	Sat Jul 13 23:58:01 2013 +0200
@@ -578,8 +578,6 @@
     py3kswitch = options.py3k_warnings and ' -3' or ''
     cmd = '%s%s "%s"' % (PYTHON, py3kswitch, test)
     vlog("# Running", cmd)
-    if os.name == 'nt':
-        replacements.append((r'\r\n', '\n'))
     return run(cmd, wd, options, replacements, env)
 
 needescape = re.compile(r'[\x00-\x08\x0b-\x1f\x7f-\xff]').search
@@ -594,8 +592,6 @@
 def rematch(el, l):
     try:
         # 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
@@ -633,8 +629,6 @@
     if el:
         if el.endswith(" (esc)\n"):
             el = el[:-7].decode('string-escape') + '\n'
-        if el == l or os.name == 'nt' and el[:-1] + '\r\n' == l:
-            return True
         if (el.endswith(" (re)\n") and rematch(el[:-6], l) or
             el.endswith(" (glob)\n") and globmatch(el[:-8], l)):
             return True
@@ -953,6 +947,7 @@
                      c.isdigit() and c or
                      '\\' + c
                      for c in testtmp), '$TESTTMP'))
+        replacements.append((r'\r\n', '\n'))
     else:
         replacements.append((re.escape(testtmp), '$TESTTMP'))