##// END OF EJS Templates
run-tests: pull out line matching function
Matt Mackall -
r15415:8c90b3df default
parent child Browse files
Show More
@@ -548,6 +548,16 b' def globmatch(el, l):'
548 res += re.escape(c)
548 res += re.escape(c)
549 return rematch(res, l)
549 return rematch(res, l)
550
550
551 def linematch(el, l):
552 if el == l: # perfect match (fast)
553 return True
554 if (el and
555 (el.endswith(" (re)\n") and rematch(el[:-6] + '\n', l) or
556 el.endswith(" (glob)\n") and globmatch(el[:-8] + '\n', l) or
557 el.endswith(" (esc)\n") and el.decode('string-escape') == l)):
558 return True
559 return False
560
551 def tsttest(test, wd, options, replacements):
561 def tsttest(test, wd, options, replacements):
552 t = open(test)
562 t = open(test)
553 out = []
563 out = []
@@ -655,14 +665,8 b' def tsttest(test, wd, options, replaceme'
655 if pos in expected and expected[pos]:
665 if pos in expected and expected[pos]:
656 el = expected[pos].pop(0)
666 el = expected[pos].pop(0)
657
667
658 if el == lout: # perfect match (fast)
668 if linematch(el, lout):
659 postout.append(" " + lout)
669 postout.append(" " + el)
660 elif (el and
661 (el.endswith(" (re)\n") and rematch(el[:-6] + '\n', lout) or
662 el.endswith(" (glob)\n") and globmatch(el[:-8] + '\n', lout)
663 or el.endswith(" (esc)\n") and
664 el.decode('string-escape') == l)):
665 postout.append(" " + el) # fallback regex/glob/esc match
666 else:
670 else:
667 if needescape(lout):
671 if needescape(lout):
668 lout = stringescape(lout.rstrip('\n')) + " (esc)\n"
672 lout = stringescape(lout.rstrip('\n')) + " (esc)\n"
General Comments 0
You need to be logged in to leave comments. Login now