diff options
Diffstat (limited to 'test/test_read_chunk.c')
-rw-r--r-- | test/test_read_chunk.c | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/test/test_read_chunk.c b/test/test_read_chunk.c index f5ba8d93..0055ef3a 100644 --- a/test/test_read_chunk.c +++ b/test/test_read_chunk.c @@ -70,15 +70,29 @@ on_end(void* handle, const SerdNode* node) return SERD_SUCCESS; } +static SerdStatus +on_event(void* handle, const SerdEvent* event) +{ + switch (event->type) { + case SERD_BASE: + return on_base(handle, event->base.uri); + case SERD_PREFIX: + return on_prefix(handle, event->prefix.name, event->prefix.uri); + case SERD_STATEMENT: + return on_statement( + handle, event->statement.flags, event->statement.statement); + case SERD_END: + break; + } + + return on_end(handle, event->end.node); +} + int main(void) { SerdWorld* world = serd_world_new(); - SerdSink* sink = serd_sink_new(NULL, NULL); - serd_sink_set_base_func(sink, on_base); - serd_sink_set_prefix_func(sink, on_prefix); - serd_sink_set_statement_func(sink, on_statement); - serd_sink_set_end_func(sink, on_end); + SerdSink* sink = serd_sink_new(NULL, on_event, NULL); SerdReader* reader = serd_reader_new(world, SERD_TURTLE, sink, 4096); assert(reader); |