diff --git a/tests/run-tests.py b/tests/run-tests.py --- a/tests/run-tests.py +++ b/tests/run-tests.py @@ -1138,14 +1138,13 @@ class TTest(Test): elif warnonly == 1: # Is "not yet" and line is warn only. warnonly = 2 # Yes do warn. break - - # clean up any optional leftovers - while expected.get(pos, None): - el = expected[pos].pop(0) - if not el.endswith(b" (?)\n"): - expected[pos].insert(0, el) - break - postout.append(b' ' + el) + else: + # clean up any optional leftovers + while expected.get(pos, None): + el = expected[pos].pop(0) + if el and not el.endswith(b" (?)\n"): + break + postout.append(b' ' + el) if lcmd: # Add on last return code. 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 @@ -52,6 +52,12 @@ a succesful test > never happens (?) > xyzzy > nor this (?) + > $ printf 'abc\ndef\nxyz\n' + > 123 (?) + > abc + > def (?) + > 456 (?) + > xyz > EOF $ rt @@ -286,6 +292,12 @@ Running In Debug Mode xyzzy + echo *SALT* 6 0 (glob) *SALT* 6 0 (glob) + + printf *abc\ndef\nxyz\n* (glob) + abc + def + xyz + + echo *SALT* 12 0 (glob) + *SALT* 12 0 (glob) . # Ran 2 tests, 0 skipped, 0 warned, 0 failed.