diff --git a/tests/run-tests.py b/tests/run-tests.py --- a/tests/run-tests.py +++ b/tests/run-tests.py @@ -531,29 +531,37 @@ def tsttest(test, options, replacements) postout = [] ret = 0 for n, l in enumerate(output): - if l.startswith(salt): + lout, lcmd = l, None + if salt in l: + lout, lcmd = l.split(salt, 1) + + if lout: + if lcmd: + lout += ' (no-eol)\n' + + el = None + 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.decode('string-escape') == l: + postout.append(" " + el) # \-escape match + elif (el and + (el.endswith(" (re)\n") and rematch(el[:-6] + '\n', lout) or + el.endswith(" (glob)\n") and globmatch(el[:-8] + '\n', lout))): + postout.append(" " + el) # fallback regex/glob match + else: + postout.append(" " + lout) # let diff deal with it + + if lcmd: # add on last return code - ret = int(l.split()[2]) + ret = int(lcmd.split()[1]) if ret != 0: postout.append(" [%s]\n" % ret) if pos in after: postout += after.pop(pos) - pos = int(l.split()[1]) - else: - el = None - if pos in expected and expected[pos]: - el = expected[pos].pop(0) - - if el == l: # perfect match (fast) - postout.append(" " + l) - elif el and el.decode('string-escape') == l: - postout.append(" " + el) # \-escape match - elif (el and - (el.endswith(" (re)\n") and rematch(el[:-6] + '\n', l) or - el.endswith(" (glob)\n") and globmatch(el[:-8] + '\n', l))): - postout.append(" " + el) # fallback regex/glob match - else: - postout.append(" " + l) # let diff deal with it + pos = int(lcmd.split()[0]) if pos in after: postout += after.pop(pos) diff --git a/tests/test-run-tests.t b/tests/test-run-tests.t --- a/tests/test-run-tests.t +++ b/tests/test-run-tests.t @@ -2,6 +2,8 @@ Simple commands: $ echo foo foo + $ printf 'oh no' + oh no (no-eol) $ printf 'bar\nbaz\n' | cat bar baz