From a2d40769d25c9495edce67be67be0ac36491ce80 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sat, 12 Nov 2022 17:54:22 -0500 Subject: Use zix_copy_file() --- test/test_filesystem.c | 38 -------------------------------------- test/test_util.c | 4 ---- 2 files changed, 42 deletions(-) (limited to 'test') diff --git a/test/test_filesystem.c b/test/test_filesystem.c index 01ccd5d..021d66f 100644 --- a/test/test_filesystem.c +++ b/test/test_filesystem.c @@ -11,7 +11,6 @@ #include "zix/path.h" #include -#include #include #include #include @@ -156,42 +155,6 @@ test_is_directory(void) free(temp_dir); } -static void -test_copy_file(void) -{ - char* const temp_dir = lilv_create_temporary_directory("lilvXXXXXX"); - char* const file_path = zix_path_join(NULL, temp_dir, "lilv_test_file"); - char* const copy_path = zix_path_join(NULL, temp_dir, "lilv_test_copy"); - - FILE* f = fopen(file_path, "w"); - fprintf(f, "test\n"); - fclose(f); - - assert(!lilv_copy_file(file_path, copy_path)); - assert(zix_file_equals(NULL, file_path, copy_path)); - - if (zix_file_type("/dev/full") != ZIX_FILE_TYPE_NONE) { - // Copy short file (error after flushing) - assert(lilv_copy_file(file_path, "/dev/full") == ENOSPC); - - // Copy long file (error during writing) - f = fopen(file_path, "w"); - for (size_t i = 0; i < 4096; ++i) { - fprintf(f, "test\n"); - } - fclose(f); - assert(lilv_copy_file(file_path, "/dev/full") == ENOSPC); - } - - assert(!zix_remove(copy_path)); - assert(!zix_remove(file_path)); - assert(!zix_remove(temp_dir)); - - free(copy_path); - free(file_path); - free(temp_dir); -} - static void test_flock(void) { @@ -275,7 +238,6 @@ main(void) test_path_parent(); test_path_filename(); test_is_directory(); - test_copy_file(); test_flock(); test_dir_for_each(); diff --git a/test/test_util.c b/test/test_util.c index f6f7feb..2e5b2fb 100644 --- a/test/test_util.c +++ b/test/test_util.c @@ -27,10 +27,6 @@ main(void) fclose(fb); fclose(fa); - assert(lilv_copy_file("does/not/exist", "copy")); - assert(lilv_copy_file(a_path, "not/a/dir/copy")); - assert(!lilv_copy_file(a_path, "copy_c")); - assert(!zix_remove(a_path)); assert(!zix_remove(b_path)); assert(!zix_remove(dir)); -- cgit v1.2.1