diff options
author | David Robillard <d@drobilla.net> | 2024-12-11 12:56:06 -0500 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2024-12-11 13:06:13 -0500 |
commit | 7dfe951f220cefdd6d40b575d26fb38fd43a0a2f (patch) | |
tree | 5c49491b87a7fef60c94774447f681e8bc15650d | |
parent | 6a89d2e44617bf39e0d44f3a4369b7c43d9a7e89 (diff) | |
download | serd-7dfe951f220cefdd6d40b575d26fb38fd43a0a2f.tar.gz serd-7dfe951f220cefdd6d40b575d26fb38fd43a0a2f.tar.bz2 serd-7dfe951f220cefdd6d40b575d26fb38fd43a0a2f.zip |
Avoid assignments in assert statements
The ways these tests are written fundamentally requires assertions to always
run, but some tools like to warn about it anyway, so avoid obvious cases.
-rw-r--r-- | test/test_writer.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/test/test_writer.c b/test/test_writer.c index e3aba50c..6590ba4a 100644 --- a/test/test_writer.c +++ b/test/test_writer.c @@ -166,10 +166,12 @@ test_writer_cleanup(void) } // Finish writing without terminating nodes - assert(!(st = serd_writer_finish(writer))); + st = serd_writer_finish(writer); + assert(!st); // Set the base to an empty URI - assert(!(st = serd_writer_set_base_uri(writer, NULL))); + st = serd_writer_set_base_uri(writer, NULL); + assert(!st); // Free (which could leak if the writer doesn't clean up the stack properly) serd_writer_free(writer); @@ -190,8 +192,9 @@ test_write_bad_anon_stack(void) SerdNode b1 = serd_node_from_string(SERD_BLANK, USTR("b1")); SerdNode b2 = serd_node_from_string(SERD_BLANK, USTR("b2")); - assert(!(st = serd_writer_write_statement( - writer, SERD_ANON_O_BEGIN, NULL, &s, &p, &b0, NULL, NULL))); + st = serd_writer_write_statement( + writer, SERD_ANON_O_BEGIN, NULL, &s, &p, &b0, NULL, NULL); + assert(!st); // (missing call to end the anonymous node here) @@ -200,7 +203,8 @@ test_write_bad_anon_stack(void) assert(st == SERD_ERR_BAD_ARG); - assert(!(st = serd_writer_finish(writer))); + st = serd_writer_finish(writer); + assert(!st); serd_writer_free(writer); serd_env_free(env); } |