diff tests/run-tests.py @ 35176:6d5718e39657

run-tests: make "| foo (re)" not match everything We make "foo (re)" match the entire line by adding a \Z to the regular expression before matching. However, that doesn't help when the regular expression is something like "| foo", because that gets translated to "| foo\Z", where the "|" has lower precedence and it thus matches the empty string, which is of course a prefix of every string. Fix by wrapping expression in a group before adding the \Z to the end. Differential Revision: https://phab.mercurial-scm.org/D1546
author Martin von Zweigbergk <martinvonz@google.com>
date Wed, 29 Nov 2017 10:34:49 -0800
parents fc0f3ed071fc
children b4b0aed7bfaf
line wrap: on
line diff
--- a/tests/run-tests.py	Wed Nov 29 10:58:32 2017 -0800
+++ b/tests/run-tests.py	Wed Nov 29 10:34:49 2017 -0800
@@ -1527,6 +1527,7 @@
     @staticmethod
     def rematch(el, l):
         try:
+            el = b'(?:' + el + b')'
             # use \Z to ensure that the regex matches to the end of the string
             if os.name == 'nt':
                 return re.match(el + br'\r?\n\Z', l)