# HG changeset patch # User Christian Ebert # Date 1318524509 -3600 # Node ID 320bd57f76a3b29711995dd8aa82bbf0e7e19333 # Parent 0f5e2d5e716babcd9b3f6666644f0db5ee7dd5bf# Parent 5fc540826f9f7737fd22192b18249d7d9db0d231 Merge with stable diff -r 0f5e2d5e716b -r 320bd57f76a3 tests/run-tests.py --- a/tests/run-tests.py Sat Oct 08 00:24:35 2011 +0100 +++ b/tests/run-tests.py Thu Oct 13 17:48:29 2011 +0100 @@ -521,6 +521,26 @@ def stringescape(s): return escapesub(escapef, s) +def transformtst(lines): + inblock = False + for l in lines: + if inblock: + if l.startswith(' $ '): + inblock = False + yield ' > EOF\n' + yield l + else: + yield ' > ' + l[2:] + else: + if l.startswith(' >>> '): + inblock = True + yield ' $ %s -m heredoctest < ' + l[2:] + else: + yield l + if inblock: + yield ' > EOF\n' + def tsttest(test, wd, options, replacements): t = open(test) out = [] @@ -530,7 +550,7 @@ pos = prepos = -1 after = {} expected = {} - for n, l in enumerate(t): + for n, l in enumerate(transformtst(t)): if not l.endswith('\n'): l += '\n' if l.startswith(' $ '): # commands @@ -833,7 +853,7 @@ refout = None # to match "out is None" elif os.path.exists(ref): f = open(ref, "r") - refout = splitnewlines(f.read()) + refout = list(transformtst(splitnewlines(f.read()))) f.close() else: refout = []