Show More
@@ -521,6 +521,26 b' def escapef(m):' | |||
|
521 | 521 | def stringescape(s): |
|
522 | 522 | return escapesub(escapef, s) |
|
523 | 523 | |
|
524 | def transformtst(lines): | |
|
525 | inblock = False | |
|
526 | for l in lines: | |
|
527 | if inblock: | |
|
528 | if l.startswith(' $ '): | |
|
529 | inblock = False | |
|
530 | yield ' > EOF\n' | |
|
531 | yield l | |
|
532 | else: | |
|
533 | yield ' > ' + l[2:] | |
|
534 | else: | |
|
535 | if l.startswith(' >>> '): | |
|
536 | inblock = True | |
|
537 | yield ' $ %s -m heredoctest <<EOF\n' % PYTHON | |
|
538 | yield ' > ' + l[2:] | |
|
539 | else: | |
|
540 | yield l | |
|
541 | if inblock: | |
|
542 | yield ' > EOF\n' | |
|
543 | ||
|
524 | 544 | def tsttest(test, wd, options, replacements): |
|
525 | 545 | t = open(test) |
|
526 | 546 | out = [] |
@@ -530,7 +550,7 b' def tsttest(test, wd, options, replaceme' | |||
|
530 | 550 | pos = prepos = -1 |
|
531 | 551 | after = {} |
|
532 | 552 | expected = {} |
|
533 | for n, l in enumerate(t): | |
|
553 | for n, l in enumerate(transformtst(t)): | |
|
534 | 554 | if not l.endswith('\n'): |
|
535 | 555 | l += '\n' |
|
536 | 556 | if l.startswith(' $ '): # commands |
@@ -833,7 +853,7 b' def runone(options, test):' | |||
|
833 | 853 | refout = None # to match "out is None" |
|
834 | 854 | elif os.path.exists(ref): |
|
835 | 855 | f = open(ref, "r") |
|
836 | refout = splitnewlines(f.read()) | |
|
856 | refout = list(transformtst(splitnewlines(f.read()))) | |
|
837 | 857 | f.close() |
|
838 | 858 | else: |
|
839 | 859 | refout = [] |
General Comments 0
You need to be logged in to leave comments.
Login now