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