From patchwork Thu Jan 16 18:22:02 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [2,of,4,V2] run-tests: test each line matching function on its own From: Simon Heimberg X-Patchwork-Id: 3354 Message-Id: <225b595f165732dd5c55.1389896522@lapsi.heimberg.home> To: Mercurial-devel Cc: Augie Fackler Date: Thu, 16 Jan 2014 19:22:02 +0100 # HG changeset patch # User Simon Heimberg # Date 1389870409 -3600 # Thu Jan 16 12:06:49 2014 +0100 # Node ID 225b595f165732dd5c55674a2c865b2ca2dd3990 # Parent 9135400b83c549f7a8138be82ab39dca4ebdcb49 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. diff -r 9135400b83c5 -r 225b595f1657 tests/run-tests.py --- a/tests/run-tests.py Thu Jan 16 19:07:18 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):