diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/lilv_test_utils.c | 13 | ||||
-rw-r--r-- | test/lilv_test_utils.h | 4 | ||||
-rw-r--r-- | test/meson.build | 1 | ||||
-rw-r--r-- | test/test_filesystem.c | 35 | ||||
-rw-r--r-- | test/test_state.c | 2 | ||||
-rw-r--r-- | test/test_util.c | 2 |
6 files changed, 18 insertions, 39 deletions
diff --git a/test/lilv_test_utils.c b/test/lilv_test_utils.c index 260390f..c3c47f0 100644 --- a/test/lilv_test_utils.c +++ b/test/lilv_test_utils.c @@ -176,3 +176,16 @@ set_env(const char* name, const char* value) setenv(name, value, 1); #endif } + +char* +lilv_create_temporary_directory(const char* pattern) +{ + char* const tmpdir = zix_temp_directory_path(NULL); + char* const path_pattern = zix_path_join(NULL, tmpdir, pattern); + char* const result = zix_create_temporary_directory(NULL, path_pattern); + + zix_free(NULL, path_pattern); + zix_free(NULL, tmpdir); + + return result; +} diff --git a/test/lilv_test_utils.h b/test/lilv_test_utils.h index 1697a9b..f01b5b4 100644 --- a/test/lilv_test_utils.h +++ b/test/lilv_test_utils.h @@ -79,4 +79,8 @@ delete_bundle(LilvTestEnv* env); void set_env(const char* name, const char* value); +// Create a unique temporary directory +char* +lilv_create_temporary_directory(const char* pattern); + #endif // LILV_TEST_UTILS_H diff --git a/test/meson.build b/test/meson.build index aa6ca2d..a8fe184 100644 --- a/test/meson.build +++ b/test/meson.build @@ -62,7 +62,6 @@ unit_tests = [ 'bad_port_symbol', 'classes', 'discovery', - 'filesystem', 'get_symbol', 'no_author', 'no_verify', diff --git a/test/test_filesystem.c b/test/test_filesystem.c deleted file mode 100644 index 2afbfda..0000000 --- a/test/test_filesystem.c +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2020 David Robillard <d@drobilla.net> -// SPDX-License-Identifier: ISC - -#undef NDEBUG - -#include "../src/filesystem.h" - -#include <assert.h> - -static void -test_path_is_child(void) -{ - assert(lilv_path_is_child("/a/b", "/a")); - assert(lilv_path_is_child("/a/b", "/a/")); - assert(lilv_path_is_child("/a/b/", "/a")); - assert(lilv_path_is_child("/a/b/", "/a/")); - - assert(!lilv_path_is_child("/a/b", "/a/c")); - assert(!lilv_path_is_child("/a/b", "/a/c/")); - assert(!lilv_path_is_child("/a/b/", "/a/c")); - assert(!lilv_path_is_child("/a/b/", "/a/c/")); - - assert(!lilv_path_is_child("/a/b", "/c")); - assert(!lilv_path_is_child("/a/b", "/c/")); - assert(!lilv_path_is_child("/a/b/", "/c")); - assert(!lilv_path_is_child("/a/b/", "/c/")); -} - -int -main(void) -{ - test_path_is_child(); - - return 0; -} diff --git a/test/test_state.c b/test/test_state.c index f29949e..798fb6e 100644 --- a/test/test_state.c +++ b/test/test_state.c @@ -6,8 +6,6 @@ #include "lilv_test_uri_map.h" #include "lilv_test_utils.h" -#include "../src/filesystem.h" - #include "lilv/lilv.h" #include "lv2/core/lv2.h" #include "lv2/state/state.h" diff --git a/test/test_util.c b/test/test_util.c index 2e5b2fb..2e609da 100644 --- a/test/test_util.c +++ b/test/test_util.c @@ -3,7 +3,7 @@ #undef NDEBUG -#include "../src/filesystem.h" +#include "lilv_test_utils.h" #include "lilv/lilv.h" #include "zix/filesystem.h" |