From abe9a7896f1f6e6a5158c0a1d4a3f39e4538c248 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Wed, 11 Dec 2024 19:04:42 -0500 Subject: Always assert the return value of fopen() in tests --- test/test_reader.c | 2 ++ test/test_reader_writer.c | 6 ++++-- 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/test_reader.c b/test/test_reader.c index e1ca0934..4db83eee 100644 --- a/test/test_reader.c +++ b/test/test_reader.c @@ -217,6 +217,7 @@ test_read_nquads_chunks(const char* const path) static const char null = 0; FILE* const f = fopen(path, "w+b"); + assert(f); // Write two statements, a null separator, then another statement @@ -303,6 +304,7 @@ test_read_turtle_chunks(const char* const path) static const char null = 0; FILE* const f = fopen(path, "w+b"); + assert(f); // Write two statements separated by null characters fprintf(f, "@base .\n"); diff --git a/test/test_reader_writer.c b/test/test_reader_writer.c index bebda449..7302fa39 100644 --- a/test/test_reader_writer.c +++ b/test/test_reader_writer.c @@ -146,10 +146,12 @@ test_write_errors(void) static void test_writer(const char* const path) { - FILE* fd = fopen(path, "wb"); - SerdEnv* env = serd_env_new(NULL); + FILE* const fd = fopen(path, "wb"); assert(fd); + SerdEnv* const env = serd_env_new(NULL); + assert(env); + SerdWriter* writer = serd_writer_new(SERD_TURTLE, (SerdStyle)0, env, NULL, serd_file_sink, fd); assert(writer); -- cgit v1.2.1