| 37 | class FsTest : public testing::Test {}; |
| 38 | |
| 39 | TEST_F(FsTest, createDirectory) { |
| 40 | auto rootPath = exec::test::TempDirectoryPath::createTempDirectory(); |
| 41 | auto tmpDirectoryPath = rootPath + "/first/second/third"; |
| 42 | // First time should generate directory successfully. |
| 43 | EXPECT_FALSE(fs::exists(tmpDirectoryPath.c_str())); |
| 44 | EXPECT_TRUE(generateFileDirectory(tmpDirectoryPath.c_str())); |
| 45 | EXPECT_TRUE(fs::exists(tmpDirectoryPath.c_str())); |
| 46 | |
| 47 | // Directory already exist, not creating but should return success. |
| 48 | EXPECT_TRUE(generateFileDirectory(tmpDirectoryPath.c_str())); |
| 49 | EXPECT_TRUE(fs::exists(tmpDirectoryPath.c_str())); |
| 50 | boost::filesystem::remove_all(rootPath); |
| 51 | EXPECT_FALSE(fs::exists(rootPath.c_str())); |
| 52 | } |
| 53 | |
| 54 | } // namespace bytedance::bolt::common |
nothing calls this directly
no test coverage detected