Mercurial > hg > mercurial-source
diff tests/run-tests.py @ 15447:9910f60a37ee
tests: make (glob) on windows accept \ instead of /
Globbing is usually used for filenames, so on windows it is reasonable and very
convenient that glob patterns accepts '\' or '/' when the pattern specifies
'/'.
author | Mads Kiilerich <mads@kiilerich.com> |
---|---|
date | Mon, 07 Nov 2011 03:25:10 +0100 (2011-11-07) |
parents | 493fffdc6398 |
children | 873f94ecd706 |
line wrap: on
line diff
--- a/tests/run-tests.py +++ b/tests/run-tests.py @@ -530,20 +530,22 @@ return False def globmatch(el, l): - # The only supported special characters are * and ?. Escaping is - # supported. + # The only supported special characters are * and ? plus / which also + # matches \ on windows. Escaping of these caracters is supported. i, n = 0, len(el) res = '' while i < n: c = el[i] i += 1 - if c == '\\' and el[i] in '*?\\': + if c == '\\' and el[i] in '*?\\/': res += el[i - 1:i + 1] i += 1 elif c == '*': res += '.*' elif c == '?': res += '.' + elif c == '/' and os.name == 'nt': + res += '[/\\\\]' else: res += re.escape(c) return rematch(res, l)