Mercurial > hg
changeset 21112:03782d2fc776
match: _globre doctests
author | Mads Kiilerich <madski@unity3d.com> |
---|---|
date | Sun, 13 Apr 2014 22:00:08 +0200 |
parents | 9d28fd795215 |
children | 00cae8a2b04e |
files | mercurial/match.py |
diffstat | 1 files changed, 15 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/match.py Thu Oct 03 18:01:21 2013 +0200 +++ b/mercurial/match.py Sun Apr 13 22:00:08 2014 +0200 @@ -228,7 +228,21 @@ return default, pattern def _globre(pat): - '''Convert an extended glob string to a regexp string.''' + r'''Convert an extended glob string to a regexp string. + + >>> print _globre(r'?') + . + >>> print _globre(r'*') + [^/]* + >>> print _globre(r'**') + .* + >>> print _globre(r'[a*?!^][^b][!c]') + [a*?!^][\^b][^c] + >>> print _globre(r'{a,b}') + (?:a|b) + >>> print _globre(r'.\*\?') + \.\*\? + ''' i, n = 0, len(pat) res = '' group = 0