Patchwork [2,of,4,V2] run-tests: test each line matching function on its own

login
register
mail settings
Submitter Simon Heimberg
Date July 18, 2013, 1:34 a.m.
Message ID <57165994b6c3c956cbed.1374111296@lapsi.heimberg.home>
Download mbox | patch
Permalink /patch/1926/
State Superseded
Commit 9e3eb009a4044fa1235a63031dbb084a1e81a7c1
Headers show

Comments

Simon Heimberg - July 18, 2013, 1:34 a.m.
# HG changeset patch
# User Simon Heimberg <simohe@besonet.ch>
# Date 1374102395 -7200
# Node ID 57165994b6c3c956cbed93115526cd188608f8fd
# Parent  d7b95f96248521d1c21cb7456e07ffb3366cc179
run-tests: test each line matching function on its own

This has sevaral advantages.
The match functions can return some information to the runone (used in the
next patch).
It is not checked that the line ends in " (glob)" when rematch() returns false.
And it looks more readable.

Patch

diff -r d7b95f962485 -r 57165994b6c3 tests/run-tests.py
--- a/tests/run-tests.py	Don Jul 18 01:06:29 2013 +0200
+++ b/tests/run-tests.py	Don Jul 18 01:06:35 2013 +0200
@@ -629,9 +629,10 @@ 
     if el:
         if el.endswith(" (esc)\n"):
             el = el[:-7].decode('string-escape') + '\n'
-        if (el.endswith(" (re)\n") and rematch(el[:-6], l) or
-            el.endswith(" (glob)\n") and globmatch(el[:-8], l)):
-            return True
+        if el.endswith(" (re)\n"):
+            return rematch(el[:-6], l)
+        elif el.endswith(" (glob)\n"):
+            return globmatch(el[:-8], l)
         elif os.altsep and l.replace('\\', '/') == el:
             return 'slash'
     return False