aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2018-07-13 21:04:54 +0200
committerDavid Robillard <d@drobilla.net>2022-01-13 23:04:03 -0500
commit9b344f6425657b2a077c3948289199155f490ff9 (patch)
tree2b8376528ba3963818de3a1c3b90895d434e9897 /test
parent480bcd2744779686916763e9a5a876afd43643b4 (diff)
downloadserd-9b344f6425657b2a077c3948289199155f490ff9.tar.gz
serd-9b344f6425657b2a077c3948289199155f490ff9.tar.bz2
serd-9b344f6425657b2a077c3948289199155f490ff9.zip
Separate ByteSink from writer
Diffstat (limited to 'test')
-rw-r--r--test/test_reader_writer.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/test/test_reader_writer.c b/test/test_reader_writer.c
index 706f5962..ec9f194b 100644
--- a/test/test_reader_writer.c
+++ b/test/test_reader_writer.c
@@ -242,9 +242,12 @@ test_writer(const char* const path)
serd_writer_free(writer);
// Test buffer sink
- SerdBuffer buffer = {NULL, 0};
- writer =
- serd_writer_new(world, SERD_TURTLE, 0, env, serd_buffer_sink, &buffer);
+ SerdBuffer buffer = {NULL, 0};
+ SerdByteSink* byte_sink =
+ serd_byte_sink_new((SerdWriteFunc)serd_buffer_sink, &buffer, 1);
+
+ writer = serd_writer_new(
+ world, SERD_TURTLE, 0, env, (SerdWriteFunc)serd_byte_sink_write, byte_sink);
const SerdNode* const base =
serd_nodes_uri(nodes, SERD_STRING("http://example.org/base"));
@@ -252,6 +255,7 @@ test_writer(const char* const path)
serd_writer_set_base_uri(writer, base);
serd_writer_free(writer);
+ serd_byte_sink_free(byte_sink);
char* out = serd_buffer_sink_finish(&buffer);
assert(!strcmp(out, "@base <http://example.org/base> .\n"));