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

login
register
mail settings
Submitter Simon Heimberg
Date Jan. 16, 2014, 11:33 a.m.
Message ID <5285c9cfd2632bbebdcb.1389872009@lapsi.heimberg.home>
Download mbox | patch
Permalink /patch/3349/
State Superseded
Commit 9e3eb009a4044fa1235a63031dbb084a1e81a7c1
Headers show

Comments

Simon Heimberg - Jan. 16, 2014, 11:33 a.m.
# HG changeset patch
# User Simon Heimberg <simohe@besonet.ch>
# Date 1389870409 -3600
#      Thu Jan 16 12:06:49 2014 +0100
# Node ID 5285c9cfd2632bbebdcb4b9f1a64c647f9046b35
# Parent  c785585c3d9356a9275966fbe05fde250610822e
run-tests: test each line matching function on its own

This has several advantages.
 * Each match function can return some information to the caller 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 c785585c3d93 -r 5285c9cfd263 tests/run-tests.py
--- a/tests/run-tests.py	Thu Jan 16 12:03:27 2014 +0100
+++ b/tests/run-tests.py	Thu Jan 16 12:06:49 2014 +0100
@@ -634,9 +634,10 @@ 
             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
+        if el.endswith(" (re)\n"):
+            return rematch(el[:-6], l)
+        if el.endswith(" (glob)\n"):
+            return globmatch(el[:-8], l)
     return False
 
 def tsttest(test, wd, options, replacements, env):