From patchwork Sat Jul 13 22:25:14 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [4,of,5] run-tests: test each line matching function on its own From: Simon Heimberg X-Patchwork-Id: 1884 Message-Id: To: Mercurial-devel Date: Sun, 14 Jul 2013 00:25:14 +0200 # HG changeset patch # User Simon Heimberg # 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