mirror of
https://github.com/facebook/sapling.git
synced 2024-10-06 23:07:18 +03:00
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$".
This commit is contained in:
parent
94cd8c2067
commit
548fb65104
@ -506,7 +506,8 @@ def tsttest(test, options):
|
||||
# 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
|
||||
|
Loading…
Reference in New Issue
Block a user