changeset 12374:4e7dd28db0dd

tests: ensure regexes match to the end of the string Regular expressions in the test suite are currently written assuming that you need a trailing ".*" to avoid matching to the end. Instead of matching regular expressions using "^pattern", this patch makes matching more restrictive by matching "^pattern$".
author Brodie Rao <brodie@bitheap.org>
date Wed, 22 Sep 2010 16:05:59 -0500
parents 58885f00b998
children 02990e22150b
files tests/run-tests.py
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/tests/run-tests.py	Wed Sep 22 16:05:59 2010 -0500
+++ b/tests/run-tests.py	Wed Sep 22 16:05:59 2010 -0500
@@ -506,7 +506,8 @@
             # hack to deal with graphlog, which looks like bogus regexes
             if el.startswith('|'):
                 el = '\\' + el
-            return re.match(el, l)
+            # ensure that the regex matches to the end of the string
+            return re.match(el + r'\Z', l)
         except re.error:
             # el is an invalid regex
             return False