diff options
author | David Robillard <d@drobilla.net> | 2023-03-31 14:20:03 -0400 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2023-12-02 18:49:07 -0500 |
commit | 09bf03fd6e522d6e421fed85d010057f87486544 (patch) | |
tree | 837adc1381f0e19e7cbab246be81de5fb6f1bf50 /test/test_writer.c | |
parent | 2f490c80f9623ac2deaeb37a29fc98d01eb20e7e (diff) | |
download | serd-09bf03fd6e522d6e421fed85d010057f87486544.tar.gz serd-09bf03fd6e522d6e421fed85d010057f87486544.tar.bz2 serd-09bf03fd6e522d6e421fed85d010057f87486544.zip |
Add empty syntax type for suppressing output
Diffstat (limited to 'test/test_writer.c')
-rw-r--r-- | test/test_writer.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/test/test_writer.c b/test/test_writer.c index 1334bb02..6066b6e3 100644 --- a/test/test_writer.c +++ b/test/test_writer.c @@ -293,6 +293,38 @@ test_writer_stack_overflow(void) serd_world_free(world); } +static void +test_write_empty_syntax(void) +{ + SerdWorld* world = serd_world_new(); + SerdEnv* env = serd_env_new(serd_empty_string()); + + SerdNode* s = serd_new_uri(serd_string("http://example.org/s")); + SerdNode* p = serd_new_uri(serd_string("http://example.org/p")); + SerdNode* o = serd_new_curie(serd_string("eg:o")); + + SerdBuffer buffer = {NULL, 0}; + + SerdWriter* writer = serd_writer_new( + world, SERD_SYNTAX_EMPTY, 0U, env, serd_buffer_sink, &buffer); + + assert(writer); + + assert(!serd_sink_write(serd_writer_sink(writer), 0U, s, p, o, NULL)); + + char* out = serd_buffer_sink_finish(&buffer); + + assert(strlen(out) == 0); + serd_free(out); + + serd_writer_free(writer); + serd_node_free(o); + serd_node_free(p); + serd_node_free(s); + serd_env_free(env); + serd_world_free(world); +} + int main(void) { @@ -303,6 +335,7 @@ main(void) test_strict_write(); test_write_error(); test_writer_stack_overflow(); + test_write_empty_syntax(); return 0; } |