Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 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