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

Simon Heimberg simohe at besonet.ch
Wed Jul 17 20:34:56 CDT 2013


# HG changeset patch
# User Simon Heimberg <simohe at 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.

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


More information about the Mercurial-devel mailing list