Add tests to RecreateSymlinkOverwriteSpec

This commit is contained in:
Julian Ospald 2016-06-05 03:22:35 +02:00
parent a27d4ed55d
commit 8f6ca81d22
No known key found for this signature in database
GPG Key ID: 511B62C09D50CD28
2 changed files with 12 additions and 2 deletions

View File

@ -29,6 +29,8 @@ setupFiles = do
createDir' "dir"
createDir' "noPerms"
createDir' "noWritePerm"
createDir' "alreadyExistsD2"
createRegularFile' "alreadyExistsD2/lala"
noPerms "noPerms"
noWritableDirPerms "noWritePerm"
writeFile' "myFile" "Blahfaselgagaga"
@ -41,7 +43,9 @@ cleanupFiles = do
deleteFile' "myFile"
deleteFile' "myFileL"
deleteFile' "alreadyExists"
deleteFile' "alreadyExistsD2/lala"
deleteDir' "alreadyExistsD"
deleteDir' "alreadyExistsD2"
deleteDir' "dir"
deleteDir' "noPerms"
deleteDir' "noWritePerm"
@ -69,7 +73,7 @@ spec = before_ setupFiles $ after_ cleanupFiles $
"alreadyExists"
Overwrite
it "recreateSymLink (Overwrite), destination already exists and is a dir" $ do
it "recreateSymLink (Overwrite), destination already exists and is an empty dir" $ do
recreateSymlink' "myFileL"
"alreadyExistsD"
Overwrite
@ -77,6 +81,13 @@ spec = before_ setupFiles $ after_ cleanupFiles $
createDir' "alreadyExistsD"
-- posix failures --
it "recreateSymLink (Overwrite), destination already exists and is a non-empty dir" $ do
recreateSymlink' "myFileL"
"alreadyExistsD2"
Overwrite
`shouldThrow`
(\e -> ioeGetErrorType e == UnsatisfiedConstraints)
it "recreateSymLink (Overwrite), wrong input type (file)" $
recreateSymlink' "myFile"
"movedFile"

View File

@ -3,7 +3,6 @@
module HPath.IO.RecreateSymlinkSpec where
-- TODO: exception if destination exists but is not a file + `OverWrite` CopyMode
import Test.Hspec