diff options
author | David Robillard <d@drobilla.net> | 2018-04-29 15:24:05 +0200 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2020-06-21 18:12:03 +0200 |
commit | f814ec24583a2dc11fc70421aec1aeb950a78244 (patch) | |
tree | a9d0e701e63a207161b7958a4d59840816ab48e8 /tests | |
parent | 4a9e954904faedc5da79c0f549722e2c4eb73a29 (diff) | |
download | serd-f814ec24583a2dc11fc70421aec1aeb950a78244.tar.gz serd-f814ec24583a2dc11fc70421aec1aeb950a78244.tar.bz2 serd-f814ec24583a2dc11fc70421aec1aeb950a78244.zip |
Add SerdWorld for shared library state
Diffstat (limited to 'tests')
-rw-r--r-- | tests/serd_test.c | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/tests/serd_test.c b/tests/serd_test.c index e16f4645..75f96489 100644 --- a/tests/serd_test.c +++ b/tests/serd_test.c @@ -109,11 +109,12 @@ test_file_uri(const char* hostname, static void test_read_chunks(void) { + SerdWorld* world = serd_world_new(); 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(SERD_TURTLE, &sink); + SerdReader* reader = serd_reader_new(world, SERD_TURTLE, &sink); assert(reader); assert(f); @@ -172,6 +173,7 @@ test_read_chunks(void) serd_reader_free(reader); fclose(f); free(rt); + serd_world_free(world); } static void @@ -531,8 +533,15 @@ test_writer(const char* const path) SerdEnv* env = serd_env_new(NULL); assert(fd); - SerdWriter* writer = serd_writer_new( - SERD_TURTLE, (SerdStyle)0, env, NULL, (SerdWriteFunc)fwrite, fd); + SerdWorld* world = serd_world_new(); + + SerdWriter* writer = serd_writer_new(world, + SERD_TURTLE, + (SerdStyle)0, + env, + NULL, + (SerdWriteFunc)fwrite, + fd); assert(writer); serd_writer_chop_blank_prefix(writer, "tmp"); @@ -610,7 +619,7 @@ test_writer(const char* const path) // Test buffer sink SerdBuffer buffer = { NULL, 0 }; writer = serd_writer_new( - SERD_TURTLE, (SerdStyle)0, env, NULL, serd_buffer_sink, &buffer); + world, SERD_TURTLE, (SerdStyle)0, env, NULL, serd_buffer_sink, &buffer); o = serd_node_new_string(SERD_URI, "http://example.org/base"); assert(!serd_writer_set_base_uri(writer, o)); @@ -622,15 +631,17 @@ test_writer(const char* const path) assert(!strcmp(out, "@base <http://example.org/base> .\n")); serd_free(out); serd_env_free(env); + serd_world_free(world); fclose(fd); } static void test_reader(const char* path) { + SerdWorld* world = serd_world_new(); ReaderTest* rt = (ReaderTest*)calloc(1, sizeof(ReaderTest)); SerdSink sink = { rt, NULL, NULL, test_sink, NULL }; - SerdReader* reader = serd_reader_new(SERD_TURTLE, &sink); + SerdReader* reader = serd_reader_new(world, SERD_TURTLE, &sink); assert(reader); SerdNode* g = serd_node_new_string(SERD_URI, "http://example.org/"); @@ -653,6 +664,7 @@ test_reader(const char* path) serd_reader_free(reader); free(rt); + serd_world_free(world); } int |