Print actual/expected lines when number of lines does not match

This commit is contained in:
Fabrice Reix 2023-05-13 14:47:52 +02:00 committed by jcamiel
parent 64cf02f386
commit 63125a8dcc
No known key found for this signature in database
GPG Key ID: 07FF11CFD55356CC

View File

@ -100,6 +100,15 @@ def test_stdout_pattern(f, result):
f"actual: {len(actual_lines)} lines\nexpected: {len(expected_pattern_lines)} lines"
)
print(f"actual <{actual}>")
print("# Actual lines")
for i, line in enumerate(actual_lines):
print("%2d: %s" % (i, line))
print("# Expected lines")
for i, line in enumerate(expected_lines):
print("%2d: %s" % (i, line))
print("# Expected Pattern lines")
for i, line in enumerate(expected_pattern_lines):
print("%2d: %s" % (i, line))
sys.exit(1)
for i in range(len(expected_pattern_lines)):
@ -149,6 +158,16 @@ def test_stderr_pattern(f, result):
print(
f"actual: {len(actual_lines)} lines\nexpected: {len(expected_pattern_lines)} lines"
)
print("# Actual lines")
for i, line in enumerate(actual_lines):
print("%2d: %s" % (i, line))
print("# Expected lines")
for i, line in enumerate(expected_lines):
print("%2d: %s" % (i, line))
print("# Expected Pattern lines")
for i, line in enumerate(expected_pattern_lines):
print("%2d: %s" % (i, line))
sys.exit(1)
for i in range(len(expected_pattern_lines)):
if not re.match(expected_pattern_lines[i], actual_lines[i]):