summaryrefslogtreecommitdiffstats
path: root/xlate-test.py
diff options
context:
space:
mode:
authorPhil Sutter <phil@nwl.cc>2021-09-06 12:52:22 +0200
committerPhil Sutter <phil@nwl.cc>2021-09-13 17:00:51 +0200
commitfa78ff15602598a5a0f229055455e67757539372 (patch)
tree3b3f6d3f3e65679cc7e1187f8db69e5b6cd6633a /xlate-test.py
parentfcbe454bf0d05612a8484723fd3e9299d4ee836f (diff)
tests: xlate-test: Don't skip any input after the first empty line
In conditionals, testing the empty string evaluates to false. This is dumb but seems intentional, as readline() method returns an empty string at EOF. This is distinct from reading an empty line as the latter contains the newline character - unless it is stripped in between readline() and conditional. The fixed commit introduced just that by accident, effectively reducing any test file to the first contained test: | $ ./xlate-test.py | [...] | 81 test files, 84 tests, 84 tests passed, 0 tests failed, 0 errors With this change in place, the summary looks much better: | 81 test files, 368 tests, 368 tests passed, 0 tests failed, 0 errors Fixes: 62828a6aff231 ("tests: xlate-test: support multiline expectation") Signed-off-by: Phil Sutter <phil@nwl.cc>
Diffstat (limited to 'xlate-test.py')
-rwxr-xr-xxlate-test.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/xlate-test.py b/xlate-test.py
index cba98b6e..1fa5eca3 100755
--- a/xlate-test.py
+++ b/xlate-test.py
@@ -48,9 +48,9 @@ def run_test(name, payload):
if process.returncode == 0:
translation = output.decode("utf-8").rstrip(" \n")
expected = payload.readline().rstrip(" \n")
- next_expected = payload.readline().rstrip(" \n")
+ next_expected = payload.readline()
if next_expected.startswith("nft"):
- expected += "\n" + next_expected
+ expected += "\n" + next_expected.rstrip(" \n")
line = payload.readline()
else:
line = next_expected