Fix tests on mac
This commit is contained in:
parent
74d686547e
commit
92cc84377d
@ -564,7 +564,7 @@ easyCopy from to cm rm = do
|
||||
--
|
||||
-- Throws:
|
||||
--
|
||||
-- - `InappropriateType` for wrong file type (directory)
|
||||
-- - `InappropriateType` or `PermissionDenied` for wrong file type (directory)
|
||||
-- - `NoSuchThing` if the file does not exist
|
||||
-- - `PermissionDenied` if the directory cannot be read
|
||||
--
|
||||
|
@ -8,6 +8,9 @@ import Test.Hspec.Formatters
|
||||
import qualified Spec
|
||||
import Utils
|
||||
import System.Posix.Temp.ByteString (mkdtemp)
|
||||
import System.Posix.Env.ByteString (getEnvDefault)
|
||||
import System.Posix.FilePath ((</>))
|
||||
import "hpath-directory" System.Posix.RawFilePath.Directory
|
||||
|
||||
|
||||
-- TODO: chardev, blockdev, namedpipe, socket
|
||||
@ -15,7 +18,8 @@ import System.Posix.Temp.ByteString (mkdtemp)
|
||||
|
||||
main :: IO ()
|
||||
main = do
|
||||
tmpBase <- mkdtemp "/tmp/"
|
||||
tmpdir <- getEnvDefault "TMPDIR" "/tmp" >>= canonicalizePath
|
||||
tmpBase <- mkdtemp (tmpdir </> "hpath-directory")
|
||||
writeIORef baseTmpDir (Just (tmpBase `BS.append` "/"))
|
||||
putStrLn $ ("Temporary test directory at: " ++ show tmpBase)
|
||||
hspecWith
|
||||
|
@ -125,7 +125,7 @@ spec = beforeAll_ (upTmpDir >> setupFiles) $ afterAll_ cleanupFiles $
|
||||
"outputDir"
|
||||
Strict
|
||||
CollectFailures
|
||||
(system $ "diff -r --no-dereference "
|
||||
(system $ "diff -r "
|
||||
++ toString tmpDir' ++ "inputDir" ++ " "
|
||||
++ toString tmpDir' ++ "outputDir"
|
||||
++ " >/dev/null")
|
||||
|
@ -104,7 +104,7 @@ spec = beforeAll_ (upTmpDir >> setupFiles) $ afterAll_ cleanupFiles $
|
||||
"outputDir"
|
||||
Overwrite
|
||||
FailEarly
|
||||
(system $ "diff -r --no-dereference "
|
||||
(system $ "diff -r "
|
||||
++ toString tmpDir' ++ "inputDir" ++ " "
|
||||
++ toString tmpDir' ++ "outputDir"
|
||||
++ " >/dev/null")
|
||||
@ -113,7 +113,7 @@ spec = beforeAll_ (upTmpDir >> setupFiles) $ afterAll_ cleanupFiles $
|
||||
|
||||
it "copyDirRecursive (Overwrite, FailEarly), destination dir already exists" $ do
|
||||
tmpDir' <- getRawTmpDir
|
||||
(system $ "diff -r --no-dereference "
|
||||
(system $ "diff -r "
|
||||
++ toString tmpDir' ++ "inputDir" ++ " "
|
||||
++ toString tmpDir' ++ "alreadyExistsD"
|
||||
++ " >/dev/null")
|
||||
@ -122,7 +122,7 @@ spec = beforeAll_ (upTmpDir >> setupFiles) $ afterAll_ cleanupFiles $
|
||||
"alreadyExistsD"
|
||||
Overwrite
|
||||
FailEarly
|
||||
(system $ "diff -r --no-dereference "
|
||||
(system $ "diff -r "
|
||||
++ toString tmpDir' ++ "inputDir" ++ " "
|
||||
++ toString tmpDir' ++ "alreadyExistsD"
|
||||
++ " >/dev/null")
|
||||
|
@ -89,7 +89,7 @@ spec = beforeAll_ (upTmpDir >> setupFiles) $ afterAll_ cleanupFiles $
|
||||
"outputDir"
|
||||
Strict
|
||||
FailEarly
|
||||
(system $ "diff -r --no-dereference "
|
||||
(system $ "diff -r "
|
||||
++ toString tmpDir' ++ "inputDir" ++ " "
|
||||
++ toString tmpDir' ++ "outputDir"
|
||||
++ " >/dev/null")
|
||||
|
@ -70,7 +70,7 @@ spec = beforeAll_ (upTmpDir >> setupFiles) $ afterAll_ cleanupFiles $
|
||||
it "deleteFile, wrong file type (directory)" $
|
||||
deleteFile' "dir"
|
||||
`shouldThrow`
|
||||
(\e -> ioeGetErrorType e == InappropriateType)
|
||||
(\e -> ioeGetErrorType e == InappropriateType || ioeGetErrorType e == PermissionDenied)
|
||||
|
||||
it "deleteFile, file does not exist" $
|
||||
deleteFile' "doesNotExist"
|
||||
|
Loading…
Reference in New Issue
Block a user