diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/lilv_test_utils.c | 11 | ||||
-rw-r--r-- | test/test_filesystem.c | 70 | ||||
-rw-r--r-- | test/test_state.c | 2 | ||||
-rw-r--r-- | test/test_util.c | 2 |
4 files changed, 7 insertions, 78 deletions
diff --git a/test/lilv_test_utils.c b/test/lilv_test_utils.c index 520b91a..e924873 100644 --- a/test/lilv_test_utils.c +++ b/test/lilv_test_utils.c @@ -8,6 +8,7 @@ #include "lilv/lilv.h" #include "serd/serd.h" #include "zix/allocator.h" +#include "zix/filesystem.h" #include "zix/path.h" #include <errno.h> @@ -32,13 +33,13 @@ lilv_test_env_new(void) env->plugin2_uri = lilv_new_uri(world, "http://example.org/foobar"); // Set custom LV2_PATH in build directory to only use test data - char* test_path = lilv_path_canonical(LILV_TEST_DIR); + char* test_path = zix_canonical_path(NULL, LILV_TEST_DIR); char* lv2_path = zix_path_join(NULL, test_path, "lv2"); LilvNode* path = lilv_new_string(world, lv2_path); lilv_world_set_option(world, LILV_OPTION_LV2_PATH, path); - zix_free(NULL, lv2_path); - free(test_path); lilv_node_free(path); + zix_free(NULL, lv2_path); + zix_free(NULL, test_path); return env; } @@ -63,13 +64,13 @@ create_bundle(LilvTestEnv* env, const char* plugin) { { - char* const test_dir = lilv_path_canonical(LILV_TEST_DIR); + char* const test_dir = zix_canonical_path(NULL, LILV_TEST_DIR); char* const bundle_dir = zix_path_join(NULL, test_dir, name); env->test_bundle_path = zix_path_join(NULL, bundle_dir, ""); zix_free(NULL, bundle_dir); - lilv_free(test_dir); + zix_free(NULL, test_dir); } if (lilv_create_directories(env->test_bundle_path)) { diff --git a/test/test_filesystem.c b/test/test_filesystem.c index dc4fd27..0e199c7 100644 --- a/test/test_filesystem.c +++ b/test/test_filesystem.c @@ -84,24 +84,6 @@ test_path_current(void) } static void -test_path_absolute(void) -{ - const char* const short_path = "a"; - const char* const long_path = "a/b/c"; - - char* const cwd = lilv_path_current(); - char* const expected_short = zix_path_join(NULL, cwd, short_path); - char* const expected_long = zix_path_join(NULL, cwd, long_path); - - assert(equals(lilv_path_absolute(short_path), expected_short)); - assert(equals(lilv_path_absolute(long_path), expected_long)); - - free(expected_long); - free(expected_short); - free(cwd); -} - -static void test_path_relative_to(void) { assert(equals(lilv_path_relative_to("/a/b", "/a/"), "b")); @@ -163,56 +145,6 @@ test_path_filename(void) } static void -test_path_canonical(void) -{ - char* const temp_dir = lilv_create_temporary_directory("lilvXXXXXX"); - char* const file_path = zix_path_join(NULL, temp_dir, "lilv_test_file"); - - FILE* f = fopen(file_path, "w"); - fprintf(f, "test\n"); - fclose(f); - -#ifndef _WIN32 - // Test symlink resolution - - char* const link_path = zix_path_join(NULL, temp_dir, "lilv_test_link"); - - assert(!lilv_symlink(file_path, link_path)); - - char* const real_file_path = lilv_path_canonical(file_path); - char* const real_link_path = lilv_path_canonical(link_path); - - assert(!strcmp(real_file_path, real_link_path)); - - assert(!lilv_remove(link_path)); - free(real_link_path); - free(real_file_path); - free(link_path); -#endif - - // Test dot segment resolution - - char* const parent_dir_1 = zix_path_join(NULL, temp_dir, ".."); - char* const parent_dir_2 = lilv_path_parent(temp_dir); - char* const real_parent_dir_1 = lilv_path_canonical(parent_dir_1); - char* const real_parent_dir_2 = lilv_path_canonical(parent_dir_2); - - assert(!strcmp(real_parent_dir_1, real_parent_dir_2)); - - // Clean everything up - - assert(!lilv_remove(file_path)); - assert(!lilv_remove(temp_dir)); - - free(real_parent_dir_2); - free(real_parent_dir_1); - free(parent_dir_2); - free(parent_dir_1); - free(file_path); - free(temp_dir); -} - -static void test_is_directory(void) { char* const temp_dir = lilv_create_temporary_directory("lilvXXXXXX"); @@ -431,11 +363,9 @@ main(void) test_path_is_absolute(); test_path_is_child(); test_path_current(); - test_path_absolute(); test_path_relative_to(); test_path_parent(); test_path_filename(); - test_path_canonical(); test_is_directory(); test_copy_file(); test_flock(); diff --git a/test/test_state.c b/test/test_state.c index 97567a2..78a4e5d 100644 --- a/test/test_state.c +++ b/test/test_state.c @@ -118,7 +118,7 @@ create_test_directories(void) /* On MacOS, temporary directories from mkdtemp involve symlinks, so resolve it here so that path comparisons in tests work. */ - dirs.top = lilv_path_canonical(top); + dirs.top = zix_canonical_path(NULL, top); dirs.shared = zix_path_join(NULL, dirs.top, "shared"); dirs.scratch = zix_path_join(NULL, dirs.shared, "scratch"); dirs.copy = zix_path_join(NULL, dirs.shared, "copy"); diff --git a/test/test_util.c b/test/test_util.c index f8fcd7f..94e5567 100644 --- a/test/test_util.c +++ b/test/test_util.c @@ -14,8 +14,6 @@ int main(void) { - assert(!lilv_path_canonical(NULL)); - char* const dir = lilv_create_temporary_directory("lilv_test_util_XXXXXX"); char* const a_path = zix_path_join(NULL, dir, "copy_a_XXXXXX"); char* const b_path = zix_path_join(NULL, dir, "copy_b_XXXXXX"); |