Show More
@@ -548,6 +548,16 b' def globmatch(el, l):' | |||
|
548 | 548 | res += re.escape(c) |
|
549 | 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 | 561 | def tsttest(test, wd, options, replacements): |
|
552 | 562 | t = open(test) |
|
553 | 563 | out = [] |
@@ -655,14 +665,8 b' def tsttest(test, wd, options, replaceme' | |||
|
655 | 665 | if pos in expected and expected[pos]: |
|
656 | 666 | el = expected[pos].pop(0) |
|
657 | 667 | |
|
658 | if el == lout: # perfect match (fast) | |
|
659 |
postout.append(" " + l |
|
|
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 | |
|
668 | if linematch(el, lout): | |
|
669 | postout.append(" " + el) | |
|
666 | 670 | else: |
|
667 | 671 | if needescape(lout): |
|
668 | 672 | lout = stringescape(lout.rstrip('\n')) + " (esc)\n" |
General Comments 0
You need to be logged in to leave comments.
Login now