diff options
author | David Robillard <d@drobilla.net> | 2022-11-12 17:54:11 -0500 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2022-11-16 10:22:55 -0500 |
commit | 67a33e70aa2b3f2f78742e773bac5ccb7be95c20 (patch) | |
tree | a00d94889233cfccaf01592906121b74db0b39bb /test/test_state.c | |
parent | d7fce849783d54c15658431552e1bd2eeec54378 (diff) | |
download | lilv-67a33e70aa2b3f2f78742e773bac5ccb7be95c20.tar.gz lilv-67a33e70aa2b3f2f78742e773bac5ccb7be95c20.tar.bz2 lilv-67a33e70aa2b3f2f78742e773bac5ccb7be95c20.zip |
Use zix_file_type() and zix_symlink_type()
Diffstat (limited to 'test/test_state.c')
-rw-r--r-- | test/test_state.c | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/test/test_state.c b/test/test_state.c index d0ccdfe..524a495 100644 --- a/test/test_state.c +++ b/test/test_state.c @@ -13,6 +13,7 @@ #include "lv2/state/state.h" #include "lv2/urid/urid.h" #include "serd/serd.h" +#include "zix/filesystem.h" #ifdef _WIN32 # include <direct.h> @@ -585,7 +586,7 @@ test_to_files(void) // Check that the test plugin has made its recording scratch file char* const recfile_path = lilv_path_join(dirs.scratch, "recfile"); - assert(lilv_path_exists(recfile_path)); + assert(zix_file_type(recfile_path) == ZIX_FILE_TYPE_REGULAR); // Get state char* const bundle_1_path = lilv_path_join(dirs.top, "state1.lv2"); @@ -597,7 +598,7 @@ test_to_files(void) // Check that a snapshop of the recfile was created char* const recfile_copy_1 = lilv_path_join(dirs.copy, "recfile"); - assert(lilv_path_exists(recfile_copy_1)); + assert(zix_file_type(recfile_copy_1) == ZIX_FILE_TYPE_REGULAR); // Save state to a bundle assert(!lilv_state_save(ctx->env->world, @@ -610,14 +611,17 @@ test_to_files(void) // Check that a manifest exists char* const manifest_path = lilv_path_join(bundle_1_path, "manifest.ttl"); - assert(lilv_path_exists(manifest_path)); + assert(zix_file_type(manifest_path) == ZIX_FILE_TYPE_REGULAR); // Check that the expected statements are in the manifest file assert(count_statements(manifest_path) == 3); // Check that a link to the recfile exists in the saved bundle char* const recfile_link_1 = lilv_path_join(bundle_1_path, "recfile"); - assert(lilv_path_exists(recfile_link_1)); + assert(zix_file_type(recfile_link_1) == ZIX_FILE_TYPE_REGULAR); +#ifndef _WIN32 + assert(zix_symlink_type(recfile_link_1) == ZIX_FILE_TYPE_SYMLINK); +#endif // Check that link points to the corresponding copy assert(lilv_file_equals(recfile_link_1, recfile_copy_1)); @@ -641,11 +645,14 @@ test_to_files(void) // Check that a new snapshop of the recfile was created char* const recfile_copy_2 = lilv_path_join(dirs.copy, "recfile.2"); - assert(lilv_path_exists(recfile_copy_2)); + assert(zix_file_type(recfile_copy_2) == ZIX_FILE_TYPE_REGULAR); // Check that a link to the recfile exists in the updated bundle char* const recfile_link_2 = lilv_path_join(bundle_2_path, "recfile"); - assert(lilv_path_exists(recfile_link_2)); + assert(zix_file_type(recfile_link_2) == ZIX_FILE_TYPE_REGULAR); +#ifndef _WIN32 + assert(zix_symlink_type(recfile_link_2) == ZIX_FILE_TYPE_SYMLINK); +#endif // Check that link points to the corresponding copy assert(lilv_file_equals(recfile_link_2, recfile_copy_2)); @@ -704,11 +711,11 @@ test_multi_save(void) // Check that a manifest exists char* const manifest_path = lilv_path_join(bundle_1_path, "manifest.ttl"); - assert(lilv_path_exists(manifest_path)); + assert(zix_file_type(manifest_path) == ZIX_FILE_TYPE_REGULAR); // Check that the state file exists char* const state_path = lilv_path_join(bundle_1_path, "state.ttl"); - assert(lilv_path_exists(state_path)); + assert(zix_file_type(state_path) == ZIX_FILE_TYPE_REGULAR); // Check that the expected statements are in the files assert(count_statements(manifest_path) == 3); @@ -724,8 +731,8 @@ test_multi_save(void) "state.ttl")); // Check that everything is the same - assert(lilv_path_exists(manifest_path)); - assert(lilv_path_exists(state_path)); + assert(zix_file_type(manifest_path) == ZIX_FILE_TYPE_REGULAR); + assert(zix_file_type(state_path) == ZIX_FILE_TYPE_REGULAR); assert(count_statements(manifest_path) == 3); assert(count_statements(state_path) == 21); @@ -1066,7 +1073,7 @@ test_delete(void) assert(n_shared_files_before == n_shared_files_after); // Ensure the state directory has been deleted - assert(!lilv_path_exists(bundle_path)); + assert(zix_file_type(bundle_path) == ZIX_FILE_TYPE_NONE); cleanup_test_directories(dirs); |