TESTS: improve naming, reorder slightly

This commit is contained in:
Julian Ospald 2016-05-02 20:36:58 +02:00
parent 782abe2584
commit 94bcc12224
No known key found for this signature in database
GPG Key ID: 511B62C09D50CD28

View File

@ -100,7 +100,6 @@ copyFileSpec =
copyFile' "test/copyFileSpec/inputFile" copyFile' "test/copyFileSpec/inputFile"
"test/copyFileSpec/outputFile" "test/copyFileSpec/outputFile"
-- posix failures --
it "copyFile, and compare" $ it "copyFile, and compare" $
copyFile'' "test/copyFileSpec/inputFile" copyFile'' "test/copyFileSpec/inputFile"
"test/copyFileSpec/outputFile" "test/copyFileSpec/outputFile"
@ -108,6 +107,7 @@ copyFileSpec =
++ "test/copyFileSpec/outputFile") ++ "test/copyFileSpec/outputFile")
`shouldReturn` ExitSuccess `shouldReturn` ExitSuccess
-- posix failures --
it "copyFile, input file does not exist" $ it "copyFile, input file does not exist" $
copyFile' "test/copyFileSpec/noSuchFile" copyFile' "test/copyFileSpec/noSuchFile"
"test/copyFileSpec/outputFile" "test/copyFileSpec/outputFile"
@ -188,13 +188,13 @@ copyDirRecursiveSpec =
`shouldThrow` `shouldThrow`
(\e -> ioeGetErrorType e == NoSuchThing) (\e -> ioeGetErrorType e == NoSuchThing)
it "copyDirRecursive, no write permission on destination dir" $ it "copyDirRecursive, no write permission on output dir" $
copyDirRecursive' "test/copyDirRecursiveSpec/inputDir" copyDirRecursive' "test/copyDirRecursiveSpec/inputDir"
"test/copyDirRecursiveSpec/noWritePerm/foo" "test/copyDirRecursiveSpec/noWritePerm/foo"
`shouldThrow` `shouldThrow`
(\e -> ioeGetErrorType e == PermissionDenied) (\e -> ioeGetErrorType e == PermissionDenied)
it "copyDirRecursive, cannot open destination dir" $ it "copyDirRecursive, cannot open output dir" $
copyDirRecursive' "test/copyDirRecursiveSpec/inputDir" copyDirRecursive' "test/copyDirRecursiveSpec/inputDir"
"test/copyDirRecursiveSpec/noPerms/foo" "test/copyDirRecursiveSpec/noPerms/foo"
`shouldThrow` `shouldThrow`
@ -218,18 +218,12 @@ copyDirRecursiveSpec =
`shouldThrow` `shouldThrow`
(\e -> ioeGetErrorType e == AlreadyExists) (\e -> ioeGetErrorType e == AlreadyExists)
it "copyDirRecursive, destination and source same file" $ it "copyDirRecursive, destination and source same directory" $
copyDirRecursive' "test/copyDirRecursiveSpec/inputDir" copyDirRecursive' "test/copyDirRecursiveSpec/inputDir"
"test/copyDirRecursiveSpec/inputDir" "test/copyDirRecursiveSpec/inputDir"
`shouldThrow` `shouldThrow`
(\e -> ioeGetErrorType e == AlreadyExists) (\e -> ioeGetErrorType e == AlreadyExists)
it "copyDirRecursive, destination in source" $
copyDirRecursive' "test/copyDirRecursiveSpec/inputDir"
"test/copyDirRecursiveSpec/inputDir/foo"
`shouldThrow`
isDestinationInSource
it "copyDirRecursive, wrong input (regular file)" $ it "copyDirRecursive, wrong input (regular file)" $
copyDirRecursive' "test/copyDirRecursiveSpec/wrongInput" copyDirRecursive' "test/copyDirRecursiveSpec/wrongInput"
"test/copyDirRecursiveSpec/outputDir" "test/copyDirRecursiveSpec/outputDir"
@ -242,6 +236,13 @@ copyDirRecursiveSpec =
`shouldThrow` `shouldThrow`
(\e -> ioeGetErrorType e == InvalidArgument) (\e -> ioeGetErrorType e == InvalidArgument)
-- custom failures
it "copyDirRecursive, destination in source" $
copyDirRecursive' "test/copyDirRecursiveSpec/inputDir"
"test/copyDirRecursiveSpec/inputDir/foo"
`shouldThrow`
isDestinationInSource
createDirSpec :: Spec createDirSpec :: Spec
createDirSpec = createDirSpec =
@ -252,12 +253,12 @@ createDirSpec =
createDir' "test/createDirSpec/newDir" createDir' "test/createDirSpec/newDir"
-- posix failures -- -- posix failures --
it "createDir, can't write to destination directory" $ it "createDir, can't write to output directory" $
createDir' "test/createDirSpec/noWritePerms/newDir" createDir' "test/createDirSpec/noWritePerms/newDir"
`shouldThrow` `shouldThrow`
(\e -> ioeGetErrorType e == PermissionDenied) (\e -> ioeGetErrorType e == PermissionDenied)
it "createDir, can't open destination directory" $ it "createDir, can't open output directory" $
createDir' "test/createDirSpec/noPerms/newDir" createDir' "test/createDirSpec/noPerms/newDir"
`shouldThrow` `shouldThrow`
(\e -> ioeGetErrorType e == PermissionDenied) (\e -> ioeGetErrorType e == PermissionDenied)
@ -321,13 +322,13 @@ renameFileSpec =
`shouldThrow` `shouldThrow`
(\e -> ioeGetErrorType e == NoSuchThing) (\e -> ioeGetErrorType e == NoSuchThing)
it "renameFile, can't write to destination directory" $ it "renameFile, can't write to output directory" $
renameFile' "test/renameFile/myFile" renameFile' "test/renameFile/myFile"
"test/renameFile/noWritePerm/renamedFile" "test/renameFile/noWritePerm/renamedFile"
`shouldThrow` `shouldThrow`
(\e -> ioeGetErrorType e == PermissionDenied) (\e -> ioeGetErrorType e == PermissionDenied)
it "renameFile, can't open destination directory" $ it "renameFile, can't open output directory" $
renameFile' "test/renameFile/myFile" renameFile' "test/renameFile/myFile"
"test/renameFile/noPerms/renamedFile" "test/renameFile/noPerms/renamedFile"
`shouldThrow` `shouldThrow`