Mercurial > hg
comparison tests/run-tests.py @ 24811:a2dcf460e141 stable
run-tests: don't error when glob matched line ends with backslash
As part of writing another test, I triggered an array index error in
glob match processing code by having a (glob) line end in a single
backslash (which is the escape character).
Adding a simple bounds check prevents the error in run-tests.py.
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Fri, 17 Apr 2015 14:12:01 -0700 |
parents | dc4daf028f9c |
children | 3fe1e07f1a32 |
comparison
equal
deleted
inserted
replaced
24810:f5416657e661 | 24811:a2dcf460e141 |
---|---|
1063 i, n = 0, len(el) | 1063 i, n = 0, len(el) |
1064 res = '' | 1064 res = '' |
1065 while i < n: | 1065 while i < n: |
1066 c = el[i] | 1066 c = el[i] |
1067 i += 1 | 1067 i += 1 |
1068 if c == '\\' and el[i] in '*?\\/': | 1068 if c == '\\' and i < n and el[i] in '*?\\/': |
1069 res += el[i - 1:i + 1] | 1069 res += el[i - 1:i + 1] |
1070 i += 1 | 1070 i += 1 |
1071 elif c == '*': | 1071 elif c == '*': |
1072 res += '.*' | 1072 res += '.*' |
1073 elif c == '?': | 1073 elif c == '?': |