diff options
author | David Robillard <d@drobilla.net> | 2018-12-29 17:36:15 -0500 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2019-12-19 20:57:55 -0500 |
commit | b1e79af3188b1caf2051fca20fba6464e4ce62d4 (patch) | |
tree | 9c8d230bd6392440c7779aebdb8e133b0a6f4faa /tests | |
parent | a20bfec928afe3be17765f7b044ecd7244502689 (diff) | |
download | serd-b1e79af3188b1caf2051fca20fba6464e4ce62d4.tar.gz serd-b1e79af3188b1caf2051fca20fba6464e4ce62d4.tar.bz2 serd-b1e79af3188b1caf2051fca20fba6464e4ce62d4.zip |
Add Env to Sink
This isn't technically necessary for any sink, but is a pattern common to every
sink implementation in serd, so having it here reduces boilerplate and
parameters in user code.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/overflow_test.c | 2 | ||||
-rw-r--r-- | tests/read_chunk_test.c | 2 | ||||
-rw-r--r-- | tests/serd_test.c | 9 |
3 files changed, 7 insertions, 6 deletions
diff --git a/tests/overflow_test.c b/tests/overflow_test.c index 4a942f58..7e545793 100644 --- a/tests/overflow_test.c +++ b/tests/overflow_test.c @@ -56,7 +56,7 @@ main(void) {NULL, 0}}; SerdWorld* world = serd_world_new(); - SerdSink* sink = serd_sink_new(NULL); + SerdSink* sink = serd_sink_new(NULL, NULL); for (const Test* t = tests; t->str; ++t) { const SerdStatus st = test(world, sink, t->str, t->stack_size); diff --git a/tests/read_chunk_test.c b/tests/read_chunk_test.c index 75750b8b..54513f06 100644 --- a/tests/read_chunk_test.c +++ b/tests/read_chunk_test.c @@ -74,7 +74,7 @@ int main(void) { SerdWorld* world = serd_world_new(); - SerdSink* sink = serd_sink_new(NULL); + 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); diff --git a/tests/serd_test.c b/tests/serd_test.c index 65079c5d..80e5b926 100644 --- a/tests/serd_test.c +++ b/tests/serd_test.c @@ -102,7 +102,7 @@ test_read_chunks(void) size_t n_statements = 0; FILE* const f = tmpfile(); static const char null = 0; - SerdSink* sink = serd_sink_new(&n_statements); + SerdSink* sink = serd_sink_new(&n_statements, NULL); assert(sink); serd_sink_set_statement_func(sink, count_statements); @@ -592,10 +592,11 @@ test_env(void) assert(serd_env_set_prefix(env, b, lit)); size_t n_prefixes = 0; - SerdSink* count_prefixes_sink = serd_sink_new(&n_prefixes); + SerdSink* count_prefixes_sink = serd_sink_new(&n_prefixes, NULL); serd_sink_set_prefix_func(count_prefixes_sink, count_prefixes); serd_env_set_prefix(env, pre, eg); serd_env_write_prefixes(env, count_prefixes_sink); + serd_sink_free(count_prefixes_sink); assert(n_prefixes == 1); SerdNode* shorter_uri = serd_new_uri("urn:foo"); @@ -659,7 +660,7 @@ test_writer(const char* const path) 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); + assert(serd_sink_get_env(iface) == env); uint8_t buf[] = { 0xEF, 0xBF, 0xBD, 0 }; SerdNode* s = serd_new_uri(""); @@ -757,7 +758,7 @@ test_reader(const char* path) SerdWorld* world = serd_world_new(); size_t n_statements = 0; - SerdSink* sink = serd_sink_new(&n_statements); + SerdSink* sink = serd_sink_new(&n_statements, NULL); serd_sink_set_statement_func(sink, count_statements); SerdReader* reader = serd_reader_new(world, SERD_TURTLE, sink, 4096); |