| 262 | } |
| 263 | |
| 264 | void GenericFileSystemTest::TestDeleteDir(FileSystem* fs) { |
| 265 | if (have_flaky_directory_tree_deletion()) GTEST_SKIP() << "Flaky directory deletion"; |
| 266 | |
| 267 | ASSERT_OK(fs->CreateDir("AB/CD/EF")); |
| 268 | ASSERT_OK(fs->CreateDir("AB/GH/IJ")); |
| 269 | CreateFile(fs, "AB/abc", ""); |
| 270 | CreateFile(fs, "AB/CD/def", ""); |
| 271 | CreateFile(fs, "AB/CD/EF/ghi", ""); |
| 272 | ASSERT_OK(fs->DeleteDir("AB/CD")); |
| 273 | ASSERT_OK(fs->DeleteDir("AB/GH/IJ")); |
| 274 | |
| 275 | AssertAllDirs(fs, {"AB", "AB/GH"}); |
| 276 | AssertAllFiles(fs, {"AB/abc"}); |
| 277 | |
| 278 | // File doesn't exist |
| 279 | ASSERT_RAISES(IOError, fs->DeleteDir("AB/GH/IJ")); |
| 280 | ASSERT_RAISES(IOError, fs->DeleteDir("")); |
| 281 | |
| 282 | AssertAllDirs(fs, {"AB", "AB/GH"}); |
| 283 | |
| 284 | // Not a directory |
| 285 | CreateFile(fs, "AB/def", ""); |
| 286 | ASSERT_RAISES(IOError, fs->DeleteDir("AB/def")); |
| 287 | |
| 288 | AssertAllDirs(fs, {"AB", "AB/GH"}); |
| 289 | AssertAllFiles(fs, {"AB/abc", "AB/def"}); |
| 290 | } |
| 291 | |
| 292 | void GenericFileSystemTest::TestDeleteDirContents(FileSystem* fs) { |
| 293 | if (have_flaky_directory_tree_deletion()) GTEST_SKIP() << "Flaky directory deletion"; |
nothing calls this directly
no test coverage detected