Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions dim-testsuite/runtest.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,11 +161,12 @@ def process_command(actual_output, expected_output, out, sort_before=False):
if sort_before:
actual_output.sort()
expected_output.sort()
for actual, expected in zip_longest(actual_output, expected_output, fillvalue=''):
expected = expected.strip('\n')
if expected.endswith(' re'):
# output and expectation are bytes, like the rest of the file handling here
for actual, expected in zip_longest(actual_output, expected_output, fillvalue=b''):
expected = expected.strip(b'\n')
if expected.endswith(b' re'):
if re.match(expected[:-3], actual):
out.write(expected + '\n')
out.write(expected + b'\n')
else:
out.write(actual + b'\n')
passed = False
Expand Down
10 changes: 10 additions & 0 deletions dim-testsuite/t/runtest-shell-output.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# The test runner compares the output of shell lines (everything that does not
# start with "ndcli") with the expected lines, exactly or as a regex when the
# expectation ends with " re".
$ echo hello
hello
$ printf 'one\ntwo\n'
one
two
$ date +%Y
^20[0-9][0-9]$ re
Loading