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>2019-12-19 20:52:30 -0500
commit5e2a5940e17f498f4cbec37ee7380a42f511c82a (patch)
tree6f33d275c19bbbc44e8f27d775216fa38262634f /tests
parent9577022620cab6005c7f46348c617898f068e479 (diff)
downloadserd-5e2a5940e17f498f4cbec37ee7380a42f511c82a.tar.gz
serd-5e2a5940e17f498f4cbec37ee7380a42f511c82a.tar.bz2
serd-5e2a5940e17f498f4cbec37ee7380a42f511c82a.zip
Add SerdWorld for shared library state
Diffstat (limited to 'tests')
-rw-r--r--tests/serd_test.c22
1 files changed, 17 insertions, 5 deletions
diff --git a/tests/serd_test.c b/tests/serd_test.c
index 5998588c..ba8ca2ce 100644
--- a/tests/serd_test.c
+++ b/tests/serd_test.c
@@ -108,11 +108,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);
@@ -171,6 +172,7 @@ test_read_chunks(void)
serd_reader_free(reader);
fclose(f);
free(rt);
+ serd_world_free(world);
}
static void
@@ -530,8 +532,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");
@@ -609,7 +618,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));
@@ -621,15 +630,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/");
@@ -652,6 +663,7 @@ test_reader(const char* path)
serd_reader_free(reader);
free(rt);
+ serd_world_free(world);
}
int