diff options
Diffstat (limited to 'test/buildtool/file_system/file_system_manager.test.cpp')
-rw-r--r-- | test/buildtool/file_system/file_system_manager.test.cpp | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/test/buildtool/file_system/file_system_manager.test.cpp b/test/buildtool/file_system/file_system_manager.test.cpp index 1ffa858f..8958854d 100644 --- a/test/buildtool/file_system/file_system_manager.test.cpp +++ b/test/buildtool/file_system/file_system_manager.test.cpp @@ -590,6 +590,33 @@ TEST_CASE("CreateFileHardlink", "[file_system]") { } } +TEST_CASE("CopyDirectoryImpl", "[file_system]") { + std::filesystem::path to{"./tmp-CreateDirCopy/tmp-dir"}; + REQUIRE(FileSystemManager::CreateDirectory(to.parent_path())); + + CHECK(FileSystemManager::CreateDirectory("a/b/c/d")); + CHECK(std::filesystem::exists("a/b/c/d")); + CHECK(std::filesystem::is_directory("a/b/c/d")); + + CHECK(FileSystemManager::WriteFile("boo", "a/bb.txt")); + + // Test copy + CHECK(FileSystemManager::CopyDirectoryImpl("a", to, true)); + + // Result should be in tmp-dir now + CHECK(std::filesystem::exists(to)); + CHECK(std::filesystem::is_directory(to)); + + CHECK(std::filesystem::exists(to / "b")); + CHECK(std::filesystem::is_directory(to / "b")); + + CHECK(std::filesystem::exists(to / "b/c")); + CHECK(std::filesystem::is_directory(to / "b/c")); + + CHECK(std::filesystem::exists(to / "bb.txt")); + CHECK(std::filesystem::is_regular_file(to / "bb.txt")); +} + TEST_CASE_METHOD(CopyFileFixture, "CreateFileHardlinkAs", "[file_system]") { auto set_perm = [&](bool is_executable) { auto const content = FileSystemManager::ReadFile(from_); |