aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2018-04-29 15:24:05 +0200
committerDavid Robillard <d@drobilla.net>2018-05-27 18:21:57 +0200
commit40268925466dba7a37b468be0bba951e7f6ca5d1 (patch)
tree066808e4923a0fb0cce7d4609e021e0b0907b5ea /tests
parent129bc1d39254ff4c56e9cffab6d064bc5863ea2f (diff)
downloadserd-40268925466dba7a37b468be0bba951e7f6ca5d1.tar.gz
serd-40268925466dba7a37b468be0bba951e7f6ca5d1.tar.bz2
serd-40268925466dba7a37b468be0bba951e7f6ca5d1.zip
Add SerdWorld for shared library state
Diffstat (limited to 'tests')
-rw-r--r--tests/read_chunk_test.c4
-rw-r--r--tests/serd_test.c9
2 files changed, 9 insertions, 4 deletions
diff --git a/tests/read_chunk_test.c b/tests/read_chunk_test.c
index ed648e5f..1e41ca8a 100644
--- a/tests/read_chunk_test.c
+++ b/tests/read_chunk_test.c
@@ -59,8 +59,9 @@ on_end(void* handle, const SerdNode* node)
int
main(int argc, char** argv)
{
+ SerdWorld* world = serd_world_new();
SerdSinkInterface sink = { 0, on_base, on_prefix, on_statement, on_end };
- SerdReader* reader = serd_reader_new(SERD_TURTLE, &sink);
+ SerdReader* reader = serd_reader_new(world, SERD_TURTLE, &sink);
if (!reader) {
FAIL("Failed to create reader\n");
}
@@ -99,5 +100,6 @@ main(int argc, char** argv)
}
serd_reader_free(reader);
+ serd_world_free(world);
return 0;
}
diff --git a/tests/serd_test.c b/tests/serd_test.c
index 9fd52852..ccb3c5b6 100644
--- a/tests/serd_test.c
+++ b/tests/serd_test.c
@@ -407,6 +407,8 @@ main(void)
// Test SerdEnv
+ SerdWorld* world = serd_world_new();
+
SerdNode* u = serd_node_new_string(SERD_URI, "http://example.org/foo");
SerdNode* b = serd_node_new_string(SERD_CURIE, "invalid");
SerdNode* c = serd_node_new_string(SERD_CURIE, "eg.2:b");
@@ -496,7 +498,7 @@ main(void)
}
SerdWriter* writer = serd_writer_new(
- SERD_TURTLE, (SerdStyle)0, env, NULL, serd_file_sink, fd);
+ world, SERD_TURTLE, (SerdStyle)0, env, NULL, serd_file_sink, fd);
if (!writer) {
FAIL("Failed to create writer\n");
}
@@ -589,7 +591,7 @@ main(void)
// 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");
if (serd_writer_set_base_uri(writer, o)) {
@@ -611,7 +613,7 @@ main(void)
ReaderTest* rt = (ReaderTest*)calloc(1, sizeof(ReaderTest));
SerdSinkInterface sink = { rt, NULL, NULL, test_sink, NULL };
- SerdReader* reader = serd_reader_new(SERD_TURTLE, &sink);
+ SerdReader* reader = serd_reader_new(world, SERD_TURTLE, &sink);
if (!reader) {
FAIL("Failed to create reader\n");
}
@@ -648,6 +650,7 @@ main(void)
fclose(fd);
serd_env_free(env);
+ serd_world_free(world);
printf("Success\n");
return 0;