diff -r 21b3c555b6f4 -r 9a8202faebb3 tests/run-tests.py --- a/tests/run-tests.py Thu Nov 03 14:51:04 2011 -0500 +++ b/tests/run-tests.py Thu Nov 03 15:08:45 2011 -0500 @@ -548,6 +548,16 @@ res += re.escape(c) return rematch(res, l) +def linematch(el, l): + if el == l: # perfect match (fast) + return True + if (el and + (el.endswith(" (re)\n") and rematch(el[:-6] + '\n', l) or + el.endswith(" (glob)\n") and globmatch(el[:-8] + '\n', l) or + el.endswith(" (esc)\n") and el.decode('string-escape') == l)): + return True + return False + def tsttest(test, wd, options, replacements): t = open(test) out = [] @@ -655,14 +665,8 @@ if pos in expected and expected[pos]: el = expected[pos].pop(0) - if el == lout: # perfect match (fast) - postout.append(" " + lout) - elif (el and - (el.endswith(" (re)\n") and rematch(el[:-6] + '\n', lout) or - el.endswith(" (glob)\n") and globmatch(el[:-8] + '\n', lout) - or el.endswith(" (esc)\n") and - el.decode('string-escape') == l)): - postout.append(" " + el) # fallback regex/glob/esc match + if linematch(el, lout): + postout.append(" " + el) else: if needescape(lout): lout = stringescape(lout.rstrip('\n')) + " (esc)\n"