diff --git a/tests/unit/test_path.c b/tests/unit/test_path.c index 569715d11..6556fd48e 100644 --- a/tests/unit/test_path.c +++ b/tests/unit/test_path.c @@ -144,3 +144,35 @@ SENTRY_TEST(path_current_exe) TEST_CHECK(sentry__path_is_file(path)); sentry__path_free(path); } + +SENTRY_TEST(path_directory) +{ + sentry_path_t *path_1 = sentry__path_new(L"foo"); + sentry_path_t *path_2 = sentry__path_new(L"foo/bar"); + sentry_path_t *path_3 = sentry__path_new(L"foo/bar\\baz"); + + // create single directory + sentry__path_create_dir_all(path_1); + TEST_CHECK(sentry__path_is_dir(path_1)); + + sentry__path_remove(path_1); + TEST_CHECK(!sentry__path_is_dir(path_1)); + + // create directories by path with forward slash + sentry__path_create_dir_all(path_2); + TEST_CHECK(sentry__path_is_dir(path_2)); + + sentry__path_remove_all(path_2); + TEST_CHECK(!sentry__path_is_dir(path_2)); + + // create directories by path with forward slash and backward slashes + sentry__path_create_dir_all(path_3); + TEST_CHECK(sentry__path_is_dir(path_3)); + + sentry__path_remove_all(path_3); + TEST_CHECK(!sentry__path_is_dir(path_3)); + + sentry__path_free(path_1); + sentry__path_free(path_2); + sentry__path_free(path_3); +} diff --git a/tests/unit/tests.inc b/tests/unit/tests.inc index f017d4b4c..dedaa9d94 100644 --- a/tests/unit/tests.inc +++ b/tests/unit/tests.inc @@ -15,6 +15,7 @@ XX(module_finder) XX(page_allocator) XX(path_basics) XX(path_current_exe) +XX(path_directory) XX(path_joining_unix) XX(path_joining_windows) XX(path_relative_filename)