X-Git-Url: http://git.scottworley.com/tl-append/blobdiff_plain/bab98a3a230bcc2161254e5796ec97e1391b4907..83acbf7efdd47b20e3107cf2cba49f83a46606d3:/tl-append-test.c diff --git a/tl-append-test.c b/tl-append-test.c index 7e8455d..57ceb98 100644 --- a/tl-append-test.c +++ b/tl-append-test.c @@ -51,6 +51,11 @@ static ex_t write_to_tl_append(const char *content) { return expectation(start, end, content); } +static void verify_line(const ex_t *ex, const char *line) { + if (strncmp(ex->message, line, strlen(ex->message) + 1) != 0) + die("Wrong contents in log file"); +} + static void verify_log_contents(ex_t exps[]) { FILE *f = fopen(FILENAME, "r"); @@ -63,8 +68,7 @@ static void verify_log_contents(ex_t exps[]) { die("Error reading log file"); if (ferror(f)) die("Error reading log file"); - if (strncmp(exps[i].message, buf, len + 1) != 0) - die("Wrong contents in log file"); + verify_line(&exps[i], buf); free(buf); } if (fclose(f) != 0)