A-M baby
This commit is contained in:
parent
764da6cbbb
commit
db842d013d
19005 changed files with 197040 additions and 7 deletions
4
Task/Empty-directory/Groovy/empty-directory-1.groovy
Normal file
4
Task/Empty-directory/Groovy/empty-directory-1.groovy
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
def isDirEmpty = { dirName ->
|
||||
def dir = new File(dirName)
|
||||
dir.exists() && dir.directory && (dir.list() as List).empty
|
||||
}
|
||||
9
Task/Empty-directory/Groovy/empty-directory-2.groovy
Normal file
9
Task/Empty-directory/Groovy/empty-directory-2.groovy
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
def currentDir = new File('.')
|
||||
def random = new Random()
|
||||
def subDirName = "dir${random.nextInt(100000)}"
|
||||
def subDir = new File(subDirName)
|
||||
subDir.mkdir()
|
||||
subDir.deleteOnExit()
|
||||
|
||||
assert ! isDirEmpty('.')
|
||||
assert isDirEmpty(subDirName)
|
||||
Loading…
Add table
Add a link
Reference in a new issue