diff options
author | Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> | 2022-02-16 12:40:53 +0200 |
---|---|---|
committer | laanwj <126646+laanwj@users.noreply.github.com> | 2022-02-17 12:30:59 +0100 |
commit | ddb75c2e87a60ed24065bdf0c3bfabf4e058cef1 (patch) | |
tree | 788fe03c819080dd59657fdbf13a16c6360a890b /src/test | |
parent | 1f46b6e46e1454b91ff7ceb31853bc440952f8eb (diff) |
test: Add fs_tests/create_directories unit test
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/fs_tests.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/test/fs_tests.cpp b/src/test/fs_tests.cpp index 4fb2c23d98..313064b294 100644 --- a/src/test/fs_tests.cpp +++ b/src/test/fs_tests.cpp @@ -152,4 +152,28 @@ BOOST_AUTO_TEST_CASE(rename) fs::remove(path2); } +#ifndef WIN32 +BOOST_AUTO_TEST_CASE(create_directories) +{ + // Test fs::create_directories workaround. + const fs::path tmpfolder{m_args.GetDataDirBase()}; + + const fs::path dir{GetUniquePath(tmpfolder)}; + fs::create_directory(dir); + BOOST_CHECK(fs::exists(dir)); + BOOST_CHECK(fs::is_directory(dir)); + BOOST_CHECK(!fs::create_directories(dir)); + + const fs::path symlink{GetUniquePath(tmpfolder)}; + fs::create_directory_symlink(dir, symlink); + BOOST_CHECK(fs::exists(symlink)); + BOOST_CHECK(fs::is_symlink(symlink)); + BOOST_CHECK(fs::is_directory(symlink)); + BOOST_CHECK(!fs::create_directories(symlink)); + + fs::remove(symlink); + fs::remove(dir); +} +#endif // WIN32 + BOOST_AUTO_TEST_SUITE_END() |