Skip to content

Commit

Permalink
tests: add initial tests for sentry__path_create_dir_all
Browse files Browse the repository at this point in the history
  • Loading branch information
Mixaill committed Jun 3, 2020
1 parent 678e4c3 commit 66525f5
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
32 changes: 32 additions & 0 deletions tests/unit/test_path.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
1 change: 1 addition & 0 deletions tests/unit/tests.inc
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 66525f5

Please sign in to comment.