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

Simon Heimberg simohe at besonet.ch
Sat Jul 13 17:25:14 CDT 2013


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

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


More information about the Mercurial-devel mailing list