TemporaryDirectory: Add an alternative constructor that can create subdirectories

This commit is contained in:
Kamil Śliwak
2021-08-27 15:11:20 +02:00
parent 9dc7360903
commit 92446cbcab
5 changed files with 42 additions and 10 deletions
+3 -6
View File
@@ -65,8 +65,7 @@ BOOST_AUTO_TEST_CASE(normalizeCLIPathForVFS_absolute_path)
BOOST_AUTO_TEST_CASE(normalizeCLIPathForVFS_relative_path)
{
TemporaryDirectory tempDir(TEST_CASE_NAME);
boost::filesystem::create_directories(tempDir.path() / "x/y/z");
TemporaryDirectory tempDir({"x/y/z"}, TEST_CASE_NAME);
TemporaryWorkingDirectory tempWorkDir(tempDir.path() / "x/y/z");
// NOTE: If path to work dir contains symlinks (often the case on macOS), boost might resolve
@@ -253,9 +252,8 @@ BOOST_AUTO_TEST_CASE(normalizeCLIPathForVFS_path_separators)
BOOST_AUTO_TEST_CASE(normalizeCLIPathForVFS_should_not_resolve_symlinks)
{
TemporaryDirectory tempDir(TEST_CASE_NAME);
TemporaryDirectory tempDir({"abc/"}, TEST_CASE_NAME);
soltestAssert(tempDir.path().is_absolute(), "");
boost::filesystem::create_directories(tempDir.path() / "abc");
if (!createSymlinkIfSupportedByFilesystem(tempDir.path() / "abc", tempDir.path() / "sym", true))
return;
@@ -269,9 +267,8 @@ BOOST_AUTO_TEST_CASE(normalizeCLIPathForVFS_should_not_resolve_symlinks)
BOOST_AUTO_TEST_CASE(normalizeCLIPathForVFS_should_resolve_symlinks_in_workdir_when_path_is_relative)
{
TemporaryDirectory tempDir(TEST_CASE_NAME);
TemporaryDirectory tempDir({"abc/"}, TEST_CASE_NAME);
soltestAssert(tempDir.path().is_absolute(), "");
boost::filesystem::create_directories(tempDir.path() / "abc");
if (!createSymlinkIfSupportedByFilesystem(tempDir.path() / "abc", tempDir.path() / "sym", true))
return;