From eaaa0046af50c3f918b95be93bfd4315b25690c0 Mon Sep 17 00:00:00 2001 From: Scott Worley Date: Thu, 31 Aug 2023 11:34:54 -0700 Subject: [PATCH] test: Populate expectation --- tl-append-test.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/tl-append-test.c b/tl-append-test.c index 22589da..3eef960 100644 --- a/tl-append-test.c +++ b/tl-append-test.c @@ -4,6 +4,17 @@ #include #include +struct expectation { + const char *message; +}; + +const struct expectation END = {NULL}; +static struct expectation expectation(const char *message) { + struct expectation exp; + exp.message = message; + return exp; +} + static void die(const char *message) { fputs(message, stderr); fputc('\n', stderr); @@ -23,7 +34,7 @@ static void remove_logfile() { } } -static void write_to_tl_append(const char *content) { +static struct expectation write_to_tl_append(const char *content) { FILE *p = popen("./tl-append", "w"); if (p == NULL) die_err("Couldn't run tl-append"); @@ -34,6 +45,7 @@ static void write_to_tl_append(const char *content) { die_err("Error closing pipe"); if (status != 0) die("tl-append exited abnormally"); + return expectation(content); } static void verify_log_contents(const char *contents) { -- 2.44.1