diff options
author | David Robillard <d@drobilla.net> | 2021-10-27 21:48:48 -0400 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2021-10-27 21:48:48 -0400 |
commit | 42c4705bbcdf0a638aca6923325ed9a5660bfc26 (patch) | |
tree | 85a2f4f19f512e74ea80803c55964c7447dcbde7 /test | |
parent | 6f36b5a3fb181f6b9f9b1538d894efe24a0e92c7 (diff) | |
download | lilv-42c4705bbcdf0a638aca6923325ed9a5660bfc26.tar.gz lilv-42c4705bbcdf0a638aca6923325ed9a5660bfc26.tar.bz2 lilv-42c4705bbcdf0a638aca6923325ed9a5660bfc26.zip |
fixup! WIP: Port to serd1
Diffstat (limited to 'test')
-rw-r--r-- | test/bad_syntax.lv2/test_bad_syntax.c | 5 | ||||
-rw-r--r-- | test/failed_instantiation.lv2/test_failed_instantiation.c | 5 | ||||
-rw-r--r-- | test/failed_lib_descriptor.lv2/test_failed_lib_descriptor.c | 5 | ||||
-rw-r--r-- | test/lib_descriptor.lv2/test_lib_descriptor.c | 5 | ||||
-rw-r--r-- | test/lilv_test_utils.c | 6 | ||||
-rw-r--r-- | test/missing_descriptor.lv2/test_missing_descriptor.c | 5 | ||||
-rw-r--r-- | test/missing_name.lv2/test_missing_name.c | 5 | ||||
-rw-r--r-- | test/missing_plugin.lv2/test_missing_plugin.c | 5 | ||||
-rw-r--r-- | test/missing_port.lv2/test_missing_port.c | 6 | ||||
-rw-r--r-- | test/missing_port_name.lv2/test_missing_port_name.c | 5 | ||||
-rw-r--r-- | test/test_state.c | 32 |
11 files changed, 48 insertions, 36 deletions
diff --git a/test/bad_syntax.lv2/test_bad_syntax.c b/test/bad_syntax.lv2/test_bad_syntax.c index 6403560..3922df0 100644 --- a/test/bad_syntax.lv2/test_bad_syntax.c +++ b/test/bad_syntax.lv2/test_bad_syntax.c @@ -25,10 +25,11 @@ main(int argc, char** argv) // Load test plugin bundle char* abs_bundle = lilv_path_absolute(bundle_path); SerdNode* bundle = - serd_new_file_uri(SERD_STRING(abs_bundle), SERD_EMPTY_STRING()); + serd_new_file_uri(NULL, SERD_STRING(abs_bundle), SERD_EMPTY_STRING()); + lilv_world_load_bundle(world, bundle); free(abs_bundle); - serd_node_free(bundle); + serd_node_free(NULL, bundle); LilvNode* plugin_uri = lilv_new_uri(world, PLUGIN_URI); const LilvPlugins* plugins = lilv_world_get_all_plugins(world); diff --git a/test/failed_instantiation.lv2/test_failed_instantiation.c b/test/failed_instantiation.lv2/test_failed_instantiation.c index 7e910c2..64e7a80 100644 --- a/test/failed_instantiation.lv2/test_failed_instantiation.c +++ b/test/failed_instantiation.lv2/test_failed_instantiation.c @@ -25,10 +25,11 @@ main(int argc, char** argv) // Load test plugin bundle char* abs_bundle = lilv_path_absolute(bundle_path); SerdNode* bundle = - serd_new_file_uri(SERD_STRING(abs_bundle), SERD_EMPTY_STRING()); + serd_new_file_uri(NULL, SERD_STRING(abs_bundle), SERD_EMPTY_STRING()); + lilv_world_load_bundle(world, bundle); free(abs_bundle); - serd_node_free(bundle); + serd_node_free(NULL, bundle); LilvNode* plugin_uri = lilv_new_uri(world, PLUGIN_URI); const LilvPlugins* plugins = lilv_world_get_all_plugins(world); diff --git a/test/failed_lib_descriptor.lv2/test_failed_lib_descriptor.c b/test/failed_lib_descriptor.lv2/test_failed_lib_descriptor.c index 920f4a5..5f7329f 100644 --- a/test/failed_lib_descriptor.lv2/test_failed_lib_descriptor.c +++ b/test/failed_lib_descriptor.lv2/test_failed_lib_descriptor.c @@ -25,10 +25,11 @@ main(int argc, char** argv) // Load test plugin bundle char* abs_bundle = lilv_path_absolute(bundle_path); SerdNode* bundle = - serd_new_file_uri(SERD_STRING(abs_bundle), SERD_EMPTY_STRING()); + serd_new_file_uri(NULL, SERD_STRING(abs_bundle), SERD_EMPTY_STRING()); + lilv_world_load_bundle(world, bundle); free(abs_bundle); - serd_node_free(bundle); + serd_node_free(NULL, bundle); LilvNode* plugin_uri = lilv_new_uri(world, PLUGIN_URI); const LilvPlugins* plugins = lilv_world_get_all_plugins(world); diff --git a/test/lib_descriptor.lv2/test_lib_descriptor.c b/test/lib_descriptor.lv2/test_lib_descriptor.c index 914986f..3909feb 100644 --- a/test/lib_descriptor.lv2/test_lib_descriptor.c +++ b/test/lib_descriptor.lv2/test_lib_descriptor.c @@ -25,10 +25,11 @@ main(int argc, char** argv) // Load test plugin bundle char* abs_bundle = lilv_path_absolute(bundle_path); SerdNode* bundle = - serd_new_file_uri(SERD_STRING(abs_bundle), SERD_EMPTY_STRING()); + serd_new_file_uri(NULL, SERD_STRING(abs_bundle), SERD_EMPTY_STRING()); + lilv_world_load_bundle(world, bundle); free(abs_bundle); - serd_node_free(bundle); + serd_node_free(NULL, bundle); LilvNode* plugin_uri = lilv_new_uri(world, PLUGIN_URI); const LilvPlugins* plugins = lilv_world_get_all_plugins(world); diff --git a/test/lilv_test_utils.c b/test/lilv_test_utils.c index 6f0b8d9..563da20 100644 --- a/test/lilv_test_utils.c +++ b/test/lilv_test_utils.c @@ -94,15 +94,15 @@ create_bundle(LilvTestEnv* env, return 1; } - SerdNode* s = - serd_new_file_uri(SERD_STRING(env->test_bundle_path), SERD_EMPTY_STRING()); + SerdNode* s = serd_new_file_uri( + NULL, SERD_STRING(env->test_bundle_path), SERD_EMPTY_STRING()); env->test_bundle_uri = lilv_new_uri(env->world, serd_node_string(s)); env->test_manifest_path = lilv_path_join(env->test_bundle_path, "manifest.ttl"); env->test_content_path = lilv_path_join(env->test_bundle_path, "plugin.ttl"); - serd_node_free(s); + serd_node_free(NULL, s); FILE* const manifest_file = fopen(env->test_manifest_path, "w"); if (!manifest_file) { diff --git a/test/missing_descriptor.lv2/test_missing_descriptor.c b/test/missing_descriptor.lv2/test_missing_descriptor.c index 3f901b0..d811d8f 100644 --- a/test/missing_descriptor.lv2/test_missing_descriptor.c +++ b/test/missing_descriptor.lv2/test_missing_descriptor.c @@ -25,10 +25,11 @@ main(int argc, char** argv) // Load test plugin bundle char* abs_bundle = lilv_path_absolute(bundle_path); SerdNode* bundle = - serd_new_file_uri(SERD_STRING(abs_bundle), SERD_EMPTY_STRING()); + serd_new_file_uri(NULL, SERD_STRING(abs_bundle), SERD_EMPTY_STRING()); + lilv_world_load_bundle(world, bundle); free(abs_bundle); - serd_node_free(bundle); + serd_node_free(NULL, bundle); LilvNode* plugin_uri = lilv_new_uri(world, PLUGIN_URI); const LilvPlugins* plugins = lilv_world_get_all_plugins(world); diff --git a/test/missing_name.lv2/test_missing_name.c b/test/missing_name.lv2/test_missing_name.c index c6de224..ef00cc1 100644 --- a/test/missing_name.lv2/test_missing_name.c +++ b/test/missing_name.lv2/test_missing_name.c @@ -25,10 +25,11 @@ main(int argc, char** argv) // Load test plugin bundle char* abs_bundle = lilv_path_absolute(bundle_path); SerdNode* bundle = - serd_new_file_uri(SERD_STRING(abs_bundle), SERD_EMPTY_STRING()); + serd_new_file_uri(NULL, SERD_STRING(abs_bundle), SERD_EMPTY_STRING()); + lilv_world_load_bundle(world, bundle); free(abs_bundle); - serd_node_free(bundle); + serd_node_free(NULL, bundle); LilvNode* plugin_uri = lilv_new_uri(world, PLUGIN_URI); const LilvPlugins* plugins = lilv_world_get_all_plugins(world); diff --git a/test/missing_plugin.lv2/test_missing_plugin.c b/test/missing_plugin.lv2/test_missing_plugin.c index 4143f36..a50f7cc 100644 --- a/test/missing_plugin.lv2/test_missing_plugin.c +++ b/test/missing_plugin.lv2/test_missing_plugin.c @@ -25,10 +25,11 @@ main(int argc, char** argv) // Load test plugin bundle char* abs_bundle = lilv_path_absolute(bundle_path); SerdNode* bundle = - serd_new_file_uri(SERD_STRING(abs_bundle), SERD_EMPTY_STRING()); + serd_new_file_uri(NULL, SERD_STRING(abs_bundle), SERD_EMPTY_STRING()); + lilv_world_load_bundle(world, bundle); free(abs_bundle); - serd_node_free(bundle); + serd_node_free(NULL, bundle); LilvNode* plugin_uri = lilv_new_uri(world, PLUGIN_URI); const LilvPlugins* plugins = lilv_world_get_all_plugins(world); diff --git a/test/missing_port.lv2/test_missing_port.c b/test/missing_port.lv2/test_missing_port.c index 05430cb..fcb5435 100644 --- a/test/missing_port.lv2/test_missing_port.c +++ b/test/missing_port.lv2/test_missing_port.c @@ -25,10 +25,12 @@ main(int argc, char** argv) // Load test plugin bundle char* const abs_bundle = lilv_path_absolute(bundle_path); const SerdStringView abs_bundle_view = SERD_STRING(abs_bundle); - SerdNode* bundle = serd_new_file_uri(abs_bundle_view, SERD_EMPTY_STRING()); + SerdNode* bundle = + serd_new_file_uri(NULL, abs_bundle_view, SERD_EMPTY_STRING()); + lilv_world_load_bundle(world, bundle); free(abs_bundle); - serd_node_free(bundle); + serd_node_free(NULL, bundle); LilvNode* plugin_uri = lilv_new_uri(world, PLUGIN_URI); const LilvPlugins* plugins = lilv_world_get_all_plugins(world); diff --git a/test/missing_port_name.lv2/test_missing_port_name.c b/test/missing_port_name.lv2/test_missing_port_name.c index e9dcae8..2832077 100644 --- a/test/missing_port_name.lv2/test_missing_port_name.c +++ b/test/missing_port_name.lv2/test_missing_port_name.c @@ -25,10 +25,11 @@ main(int argc, char** argv) // Load test plugin bundle char* abs_bundle = lilv_path_absolute(bundle_path); SerdNode* bundle = - serd_new_file_uri(SERD_STRING(abs_bundle), SERD_EMPTY_STRING()); + serd_new_file_uri(NULL, SERD_STRING(abs_bundle), SERD_EMPTY_STRING()); + lilv_world_load_bundle(world, bundle); free(abs_bundle); - serd_node_free(bundle); + serd_node_free(NULL, bundle); LilvNode* plugin_uri = lilv_new_uri(world, PLUGIN_URI); const LilvPlugins* plugins = lilv_world_get_all_plugins(world); diff --git a/test/test_state.c b/test/test_state.c index 1acad5e..2951b61 100644 --- a/test/test_state.c +++ b/test/test_state.c @@ -248,7 +248,7 @@ load_test_plugin(const TestContext* const ctx) LilvWorld* world = ctx->env->world; char* abs_bundle = lilv_path_absolute(LILV_TEST_BUNDLE); SerdNode* bundle = - serd_new_file_uri(SERD_STRING(abs_bundle), SERD_EMPTY_STRING()); + serd_new_file_uri(NULL, SERD_STRING(abs_bundle), SERD_EMPTY_STRING()); LilvNode* bundle_uri = lilv_new_uri(world, serd_node_string(bundle)); LilvNode* plugin_uri = lilv_new_uri(world, TEST_PLUGIN_URI); @@ -260,7 +260,7 @@ load_test_plugin(const TestContext* const ctx) lilv_node_free(plugin_uri); lilv_node_free(bundle_uri); - serd_node_free(bundle); + serd_node_free(NULL, bundle); free(abs_bundle); assert(plugin); @@ -549,26 +549,25 @@ count_statements(const char* path) { size_t n_statements = 0; - SerdWorld* const world = serd_world_new(); + SerdWorld* const world = serd_world_new(NULL); const SerdStringView path_view = SERD_STRING(path); - SerdNode* const base = serd_new_file_uri(path_view, SERD_EMPTY_STRING()); + SerdNode* const base = + serd_new_file_uri(NULL, path_view, SERD_EMPTY_STRING()); - SerdEnv* const env = serd_env_new(serd_node_string_view(base)); - SerdSink* const sink = serd_sink_new(&n_statements, count_func, NULL); + SerdEnv* const env = serd_env_new(world, serd_node_string_view(base)); + SerdSink* const sink = serd_sink_new(world, &n_statements, count_func, NULL); SerdReader* const reader = serd_reader_new(world, SERD_TURTLE, 0, env, sink, 4096); - SerdByteSource* const source = serd_byte_source_new_filename(path, 4096); - - SerdStatus st = SERD_SUCCESS; - assert(!(st = serd_reader_start(reader, source))); + SerdInputStream in = serd_open_input_file(path); + SerdStatus st = SERD_SUCCESS; + assert(!(st = serd_reader_start(reader, &in, NULL, 4096))); assert(!(st = serd_reader_read_document(reader))); - serd_byte_source_free(source); - serd_reader_free(reader); + serd_close_input(&in); serd_sink_free(sink); serd_env_free(env); - serd_node_free(base); + serd_node_free(NULL, base); serd_world_free(world); return n_statements; @@ -918,10 +917,13 @@ test_world_round_trip(void) "state.ttl")); // Load state bundle into world + SerdNode* bundle_uri = - serd_new_file_uri(SERD_STRING(bundle_path), SERD_EMPTY_STRING()); + serd_new_file_uri(NULL, SERD_STRING(bundle_path), SERD_EMPTY_STRING()); + LilvNode* const bundle_node = lilv_new_uri(world, serd_node_string(bundle_uri)); + LilvNode* const state_node = lilv_new_uri(world, state_uri); lilv_world_load_bundle(world, bundle_node); lilv_world_load_resource(world, state_node); @@ -945,7 +947,7 @@ test_world_round_trip(void) lilv_state_free(restored); lilv_node_free(state_node); lilv_node_free(bundle_node); - serd_node_free(bundle_uri); + serd_node_free(NULL, bundle_uri); lilv_state_free(start_state); free(bundle_path); test_context_free(ctx); |