Skip to content

Commit

Permalink
print out where the output differs
Browse files Browse the repository at this point in the history
which helps with long output
  • Loading branch information
alandekok committed Apr 6, 2019
1 parent c62b5d1 commit 88a05a9
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/bin/unit_test_attribute.c
Original file line number Diff line number Diff line change
Expand Up @@ -920,8 +920,22 @@ do { \
}

if (strcmp(p + 5, output) != 0) {
char *a, *b;

fprintf(stderr, "Mismatch at line %d of %s\n\tgot : %s\n\texpected : %s\n",
lineno, directory, output, p + 5);

a = p + 5;
b = output;

while (*a == *b) {
a++;
b++;
}

fprintf(stderr, "\tdiffer at %zd\n\tgot ... %s\n\texpected ... %s\n",
(b - output), b, a);

goto error;
}
fr_strerror(); /* Clear the error buffer */
Expand Down

0 comments on commit 88a05a9

Please sign in to comment.