##// END OF EJS Templates
tests: catch re.error if test line is not a valid regular expression
Nicolas Dumazet -
r11781:6f59154f default
parent child Browse files
Show More
@@ -499,6 +499,13 b' def tsttest(test, options):'
499 499 finally:
500 500 os.remove(name)
501 501
502 def rematch(el, l):
503 try:
504 return re.match(el, l)
505 except re.error:
506 # el is an invalid regex
507 return False
508
502 509 pos = -1
503 510 postout = []
504 511 for n, l in enumerate(output):
@@ -513,7 +520,7 b' def tsttest(test, options):'
513 520
514 521 if el == l: # perfect match (fast)
515 522 postout.append(" " + l)
516 elif el and re.match(el, l): # fallback regex match
523 elif el and rematch(el, l): # fallback regex match
517 524 postout.append(" " + el)
518 525 else: # mismatch - let diff deal with it
519 526 postout.append(" " + l)
General Comments 0
You need to be logged in to leave comments. Login now