# HG changeset patch # User Mads Kiilerich # Date 1348613787 -7200 # Node ID cdabdd17f980e0290f93682d843759fa3ccc5db0 # Parent bb419c4bfdd9a6dee7401b07f759c112729805f5 run-tests: allow test output lines to be terminated with \r in addition to \n str.splitlines could not be used in 546c76e5a3e6, but _now_ we would like to have lines with other line endings than \n. Some fine occurences of (esc) markup of \r is replaced with multiple lines ending with '\r (no-eol) (esc)'. That is no win but also no significant loss. This change makes it possible to drop filtercr.py - _that_ is a win. [ original upstream message ] diff -r bb419c4bfdd9 -r cdabdd17f980 tests/run-tests.py --- a/tests/run-tests.py Wed Oct 10 01:37:53 2012 +0200 +++ b/tests/run-tests.py Wed Sep 26 00:56:27 2012 +0200 @@ -283,21 +283,6 @@ shutil.copy(src, dst) os.remove(src) -def splitnewlines(text): - '''like str.splitlines, but only split on newlines. - keep line endings.''' - i = 0 - lines = [] - while True: - n = text.find('\n', i) - if n == -1: - last = text[i:] - if last: - lines.append(last) - return lines - lines.append(text[i:n + 1]) - i = n + 1 - def parsehghaveoutput(lines): '''Parse hghave log lines. Return tuple of lists (missing, failed): @@ -761,7 +746,7 @@ for s, r in replacements: output = re.sub(s, r, output) - return ret, splitnewlines(output) + return ret, output.splitlines(True) def runone(options, test): '''tristate output: @@ -924,7 +909,7 @@ refout = None # to match "out is None" elif os.path.exists(ref): f = open(ref, "r") - refout = list(splitnewlines(f.read())) + refout = f.read().splitlines(True) f.close() else: refout = []