diff options
author | David Robillard <d@drobilla.net> | 2024-12-11 12:53:03 -0500 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2024-12-11 13:06:24 -0500 |
commit | f24963e3fcca949456e3867d9d0776e3fc63c1a4 (patch) | |
tree | f6e1ae5943efb17591b7fab4b35ced36dee7880e | |
parent | 3ba500ed9f2f073bd3c35e9b09d25bf0d08a09e8 (diff) | |
download | serd-f24963e3fcca949456e3867d9d0776e3fc63c1a4.tar.gz serd-f24963e3fcca949456e3867d9d0776e3fc63c1a4.tar.bz2 serd-f24963e3fcca949456e3867d9d0776e3fc63c1a4.zip |
Ensure success of fclose() for writable files in tests
-rw-r--r-- | test/test_reader.c | 11 | ||||
-rw-r--r-- | test/test_reader_writer.c | 2 | ||||
-rw-r--r-- | test/test_writer.c | 5 |
3 files changed, 10 insertions, 8 deletions
diff --git a/test/test_reader.c b/test/test_reader.c index 1b6ecbfe..e1ca0934 100644 --- a/test/test_reader.c +++ b/test/test_reader.c @@ -183,7 +183,7 @@ test_read_eof_file(const char* const path) serd_reader_end_stream(reader); serd_reader_free(reader); - fclose(f); + assert(!fclose(f)); } // A byte-wise reader hits EOF once then continues (like a socket) @@ -292,8 +292,9 @@ test_read_nquads_chunks(const char* const path) assert(serd_reader_read_chunk(reader) == SERD_FAILURE); serd_reader_end_stream(reader); serd_reader_free(reader); - fclose(f); - remove(path); + + assert(!fclose(f)); + assert(!remove(path)); } static void @@ -383,8 +384,8 @@ test_read_turtle_chunks(const char* const path) assert(serd_reader_read_chunk(reader) == SERD_FAILURE); serd_reader_end_stream(reader); serd_reader_free(reader); - fclose(f); - remove(path); + assert(!fclose(f)); + assert(!remove(path)); } int diff --git a/test/test_reader_writer.c b/test/test_reader_writer.c index cbe33a4d..bebda449 100644 --- a/test/test_reader_writer.c +++ b/test/test_reader_writer.c @@ -261,7 +261,7 @@ test_writer(const char* const path) serd_free(out); serd_env_free(env); - fclose(fd); + assert(!fclose(fd)); } static void diff --git a/test/test_writer.c b/test/test_writer.c index 6590ba4a..28c8e117 100644 --- a/test/test_writer.c +++ b/test/test_writer.c @@ -238,8 +238,9 @@ test_strict_write(void) serd_writer_free(writer); serd_env_free(env); - fclose(fd); - remove(path); + + assert(!fclose(fd)); + assert(!remove(path)); } // Produce a write error without setting errno |