diff options
Diffstat (limited to 'tests/logerr.c')
-rw-r--r-- | tests/logerr.c | 27 |
1 files changed, 11 insertions, 16 deletions
diff --git a/tests/logerr.c b/tests/logerr.c index 3eef2c5..8ae1140 100644 --- a/tests/logerr.c +++ b/tests/logerr.c @@ -9,9 +9,12 @@ #include "slurp.h" + static const char *const FNAME = __FILE__ ".txt"; + + static int test_vlogerr(void) { int rc = -1; @@ -24,7 +27,7 @@ test_vlogerr(void) { testing("empty varargs"); file = fopen(FNAME, "w"); - if (!file) { + if (file == NULL) { perror("fopen(FNAME, \"w\")"); goto out; } @@ -57,7 +60,7 @@ test_vlogerr(void) { testing("a newline only"); file = fopen(FNAME, "w"); - if (!file) { + if (file == NULL) { perror("fopen(FNAME, \"w\")"); goto out; } @@ -90,7 +93,7 @@ test_vlogerr(void) { testing("static format string"); file = fopen(FNAME, "w"); - if (!file) { + if (file == NULL) { perror("fopen(FNAME, \"w\")"); goto out; } @@ -123,7 +126,7 @@ test_vlogerr(void) { testing("single arg format string"); file = fopen(FNAME, "w"); - if (!file) { + if (file == NULL) { perror("fopen(FNAME, \"w\")"); goto out; } @@ -156,7 +159,7 @@ test_vlogerr(void) { testing("multiple format strings"); file = fopen(FNAME, "w"); - if (!file) { + if (file == NULL) { perror("fopen(FNAME, \"w\")"); goto out; } @@ -195,7 +198,7 @@ out: if (str != NULL) { freeit((void *)&str); } - if (file) { + if (file != NULL) { if (fclose(file)) { perror("fclose(file)"); rc = -1; @@ -204,10 +207,8 @@ out: return rc; } -static int +static void test_logerr(void) { - int rc = -1; - test_start("logerr()"); { @@ -238,9 +239,6 @@ test_logerr(void) { test_ok(); } - - rc = 0; - return rc; } @@ -253,10 +251,7 @@ main(void) { goto out; } - if (test_logerr()) { - perror("test_logerr()"); - goto out; - } + test_logerr(); rc = EXIT_SUCCESS; out: |