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

login
register
mail settings
Submitter Simon Heimberg
Date July 13, 2013, 10:25 p.m.
Message ID <dfbcc4f0944be9c93f72.1373754314@lapsi.heimberg.home>
Download mbox | patch
Permalink /patch/1884/
State Superseded, archived
Headers show

Comments

Simon Heimberg - July 13, 2013, 10:25 p.m.
# HG changeset patch
# User Simon Heimberg <simohe@besonet.ch>
# Date 1373752968 -7200
# Node ID dfbcc4f0944be9c93f72bb7942cde25457bd6559
# Parent  d9fa7503933a2491fc1bb0d2f5c921655d8f9f37
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 d9fa7503933a -r dfbcc4f0944b tests/run-tests.py
--- a/tests/run-tests.py	Son Jul 14 00:02:28 2013 +0200
+++ b/tests/run-tests.py	Son Jul 14 00:02:48 2013 +0200
@@ -623,9 +623,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