diff options
author | David Robillard <d@drobilla.net> | 2018-06-15 15:15:55 -0400 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2019-12-19 20:55:25 -0500 |
commit | c566f7ca434f28f68959c6c345babd07aa12e716 (patch) | |
tree | d273f29224459bffe0ca4310b81a2cc78d03e7d5 /tests | |
parent | 148fd83672c219138499380664d5e0fe37605ea7 (diff) | |
download | serd-c566f7ca434f28f68959c6c345babd07aa12e716.tar.gz serd-c566f7ca434f28f68959c6c345babd07aa12e716.tar.bz2 serd-c566f7ca434f28f68959c6c345babd07aa12e716.zip |
Make SerdSink opaque
Diffstat (limited to 'tests')
-rw-r--r-- | tests/serd_test.c | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/tests/serd_test.c b/tests/serd_test.c index 942f36ad..6f5397da 100644 --- a/tests/serd_test.c +++ b/tests/serd_test.c @@ -109,12 +109,14 @@ test_read_chunks(void) ReaderTest* const rt = (ReaderTest*)calloc(1, sizeof(ReaderTest)); FILE* const f = tmpfile(); static const char null = 0; - SerdSink sink = {rt, NULL, NULL, test_sink, NULL}; - SerdReader* reader = serd_reader_new(world, SERD_TURTLE, &sink, 4096); + SerdSink* sink = serd_sink_new(rt); + SerdReader* reader = serd_reader_new(world, SERD_TURTLE, sink, 4096); assert(reader); assert(f); + serd_sink_set_statement_func(sink, test_sink); + SerdStatus st = serd_reader_start_stream(reader, (SerdReadFunc)fread, (SerdStreamErrorFunc)ferror, @@ -162,6 +164,7 @@ test_read_chunks(void) assert(rt->n_statements == 2); serd_reader_free(reader); + serd_sink_free(sink); fclose(f); free(rt); serd_world_free(world); @@ -632,9 +635,9 @@ test_writer(const char* const path) SerdNode* lit = serd_new_string("hello"); const SerdSink* iface = serd_writer_get_sink(writer); - assert(iface->base(iface->handle, lit)); - assert(iface->prefix(iface->handle, lit, lit)); - assert(iface->end(iface->handle, NULL)); + assert(serd_sink_write_base(iface, lit)); + assert(serd_sink_write_prefix(iface, lit, lit)); + assert(serd_sink_write_end(iface, NULL)); assert(serd_writer_get_env(writer) == env); uint8_t buf[] = { 0xEF, 0xBF, 0xBD, 0 }; @@ -723,9 +726,12 @@ static void test_reader(const char* path) { SerdWorld* world = serd_world_new(); - ReaderTest rt = { 0, NULL }; - SerdSink sink = { &rt, NULL, NULL, test_sink, NULL }; - SerdReader* reader = serd_reader_new(world, SERD_TURTLE, &sink, 4096); + + ReaderTest rt = { 0, NULL }; + SerdSink* sink = serd_sink_new(&rt); + serd_sink_set_statement_func(sink, test_sink); + + SerdReader* reader = serd_reader_new(world, SERD_TURTLE, sink, 4096); assert(reader); SerdNode* g = serd_new_uri("http://example.org/"); @@ -746,6 +752,8 @@ test_reader(const char* path) serd_reader_finish(reader); serd_reader_free(reader); + serd_sink_free(sink); + serd_world_free(world); } |