match: _globre doctests
authorMads Kiilerich <madski@unity3d.com>
Sun, 13 Apr 2014 22:00:08 +0200
changeset 21112 03782d2fc776
parent 21111 9d28fd795215
child 21113 00cae8a2b04e
match: _globre doctests
mercurial/match.py
--- 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