diff options
author | David Robillard <d@drobilla.net> | 2021-08-13 19:31:26 -0400 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2023-12-02 18:49:08 -0500 |
commit | 828c1018f38bab9a930cecce64646366d051d39b (patch) | |
tree | 38a60777520efb17017ed62fe3b299ba94aaccf2 /test/test_terse_write.c | |
parent | a083c64f506175029280ff76defa0ad7d7ae2ea0 (diff) | |
download | serd-828c1018f38bab9a930cecce64646366d051d39b.tar.gz serd-828c1018f38bab9a930cecce64646366d051d39b.tar.bz2 serd-828c1018f38bab9a930cecce64646366d051d39b.zip |
Simplify output stream API
Diffstat (limited to 'test/test_terse_write.c')
-rw-r--r-- | test/test_terse_write.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/test/test_terse_write.c b/test/test_terse_write.c index 17bacc13..39e3767a 100644 --- a/test/test_terse_write.c +++ b/test/test_terse_write.c @@ -6,6 +6,7 @@ #include "serd/buffer.h" #include "serd/env.h" #include "serd/node.h" +#include "serd/output_stream.h" #include "serd/sink.h" #include "serd/statement.h" #include "serd/string_view.h" @@ -28,6 +29,8 @@ check_output(SerdWriter* writer, SerdBuffer* buffer, const char* expected) const char* output = (const char*)buffer->buf; + fprintf(stderr, "output: %s\n", output); + fprintf(stderr, "expected: %s\n", expected); assert(!strcmp(output, expected)); buffer->len = 0; @@ -53,8 +56,9 @@ test(void) serd_env_set_prefix(env, serd_string("rdf"), serd_string(NS_RDF)); - SerdWriter* writer = - serd_writer_new(world, SERD_TURTLE, 0, env, serd_buffer_write, &buffer); + SerdOutputStream output = serd_open_output_buffer(&buffer); + SerdWriter* const writer = + serd_writer_new(world, SERD_TURTLE, 0, env, &output, 1U); const SerdSink* sink = serd_writer_sink(writer); @@ -86,7 +90,6 @@ test(void) serd_sink_write(sink, 0, l2, rdf_rest, rdf_nil, NULL); check_output(writer, &buffer, "[] rdf:value ( \"s1\" \"s2\" ) .\n"); - serd_buffer_close(&buffer); serd_writer_free(writer); serd_node_free(rdf_nil); serd_node_free(rdf_rest); @@ -97,6 +100,7 @@ test(void) serd_node_free(l2); serd_node_free(l1); serd_node_free(b1); + serd_close_output(&output); serd_env_free(env); serd_world_free(world); free(buffer.buf); |