File.deleteRecursively returns true even if path specified by File does not exist.
False is returned only in case of incomplete deletion. Distinguish situations when file was not deleted because it's vanished after listing and because of some other error.
This commit is contained in:
@@ -440,7 +440,7 @@ class FilesTest {
|
||||
|
||||
assertTrue(dir.deleteRecursively())
|
||||
assertFalse(dir.exists())
|
||||
assertFalse(dir.deleteRecursively())
|
||||
assertTrue(dir.deleteRecursively())
|
||||
}
|
||||
|
||||
@test fun deleteRecursivelyWithFail() {
|
||||
@@ -449,7 +449,7 @@ class FilesTest {
|
||||
try {
|
||||
if (restricted.setReadable(false)) {
|
||||
if (File(basedir, "7.txt").setReadable(false)) {
|
||||
basedir.deleteRecursively()
|
||||
assertFalse(basedir.deleteRecursively(), "Expected incomplete recursive deletion.")
|
||||
restricted.setReadable(true)
|
||||
File(basedir, "7.txt").setReadable(true)
|
||||
var i = 0
|
||||
|
||||
Reference in New Issue
Block a user