Skip to content

Commit

Permalink
test(common-utils): Add a test for deleting with a base directory
Browse files Browse the repository at this point in the history
Signed-off-by: Sebastian Schuberth <sebastian@doubleopen.org>
  • Loading branch information
sschuberth committed Sep 3, 2024
1 parent bb012f3 commit e0e8465
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions utils/common/src/test/kotlin/ExtensionsTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,20 @@ class ExtensionsTest : WordSpec({

dir.exists() shouldBe false
}

"delete empty parent directories below a base directory" {
val tempDir = tempdir()
val baseDir = tempDir.resolve("a/basedir")
val deleteDir = baseDir.resolve("c/delete").apply { safeMkdirs() }

shouldNotThrow<IOException> {
deleteDir.safeDeleteRecursively(force = true, baseDir)
}

deleteDir.exists() shouldBe false
deleteDir.parentFile.exists() shouldBe false
baseDir.exists() shouldBe true
}
}

"File.expandTilde()" should {
Expand Down

0 comments on commit e0e8465

Please sign in to comment.