summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorMitya Selivanov <automainint@guattari.tech>2023-09-15 22:49:11 +0200
committerMitya Selivanov <automainint@guattari.tech>2023-09-15 22:49:11 +0200
commit1d7fade29c68ec4bb4bb433088894aa1e4d7f50e (patch)
tree5f7d90beb6e998455da4b53c90f148304523a4c1 /source
parentd103efdb7260d2c7ca3ad04c7a914028001d4652 (diff)
downloadkit-1d7fade29c68ec4bb4bb433088894aa1e4d7f50e.zip
test
Diffstat (limited to 'source')
-rw-r--r--source/kit/file.c13
-rw-r--r--source/tests/file.test.c4
2 files changed, 8 insertions, 9 deletions
diff --git a/source/kit/file.c b/source/kit/file.c
index 52b27fa..1483195 100644
--- a/source/kit/file.c
+++ b/source/kit/file.c
@@ -301,28 +301,31 @@ kit_status_t kit_file_remove_recursive(kit_str_t path,
case KIT_PATH_FOLDER: {
kit_path_list_t list = kit_folder_enum(path, alloc);
- printf(" >> 1 \n"); fflush(stdout);
-
assert(list.status == KIT_OK);
if (list.status != KIT_OK) {
kit_path_list_destroy(list);
return list.status;
}
- printf(" >> 2 \n"); fflush(stdout);
for (i = 0; i < list.files.size; i++) {
+ printf(" >> 1 \n");
+ fflush(stdout);
str_builder_t full_path = kit_path_join(
path, WRAP_STR(list.files.values[i]), alloc);
+ printf(" >> 2 \n");
+ fflush(stdout);
kit_status_t s = kit_file_remove_recursive(
WRAP_STR(full_path), alloc);
+ printf(" >> 3 \n");
+ fflush(stdout);
DA_DESTROY(full_path);
+ printf(" >> 4 \n");
+ fflush(stdout);
assert(s == KIT_OK);
}
- printf(" >> 3 \n"); fflush(stdout);
kit_path_list_destroy(list);
- printf(" >> 4 \n"); fflush(stdout);
kit_status_t s = kit_folder_remove(path);
assert(s == KIT_OK);
return s;
diff --git a/source/tests/file.test.c b/source/tests/file.test.c
index 7a6224d..9ec51bf 100644
--- a/source/tests/file.test.c
+++ b/source/tests/file.test.c
@@ -224,11 +224,7 @@ TEST("create folder recursive") {
path_type(SZ("test_folder" PATH_DELIM "foo" PATH_DELIM "bar")),
PATH_FOLDER);
REQUIRE_EQ(file_remove_recursive(SZ("test_folder"), NULL), KIT_OK);
- printf(" 1 \n");
- fflush(stdout);
REQUIRE_EQ(path_type(SZ("test_folder")), PATH_NONE);
- printf(" 2 \n");
- fflush(stdout);
}
TEST("file remove") {