TESTS: less side effects plz

This commit is contained in:
2016-06-05 14:33:53 +02:00
parent 5d1c5cc2ce
commit bc348c7dd5
21 changed files with 262 additions and 54 deletions

View File

@@ -19,9 +19,18 @@ import System.Exit
import System.Process
import Utils
import Data.ByteString.UTF8 (toString)
import Data.IORef
(
readIORef
)
upTmpDir :: IO ()
upTmpDir = do
setTmpDir "CopyDirRecursiveSpec"
createTmpDir
setupFiles :: IO ()
setupFiles = do
createRegularFile' "alreadyExists"
@@ -67,7 +76,7 @@ cleanupFiles = do
spec :: Spec
spec = before_ setupFiles $ after_ cleanupFiles $
spec = beforeAll_ upTmpDir $ before_ setupFiles $ after_ cleanupFiles $
describe "HPath.IO.copyDirRecursive" $ do
-- successes --
@@ -79,13 +88,14 @@ spec = before_ setupFiles $ after_ cleanupFiles $
removeDirIfExists "outputDir"
it "copyDirRecursive (Strict, FailEarly), all fine and compare" $ do
tmpDir' <- getRawTmpDir
copyDirRecursive' "inputDir"
"outputDir"
Strict
FailEarly
(system $ "diff -r --no-dereference "
++ toString tmpDir ++ "inputDir" ++ " "
++ toString tmpDir ++ "outputDir")
++ toString tmpDir' ++ "inputDir" ++ " "
++ toString tmpDir' ++ "outputDir")
`shouldReturn` ExitSuccess
removeDirIfExists "outputDir"