summaryrefslogtreecommitdiff
path: root/Test.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2013-05-11 19:14:30 -0400
committerGravatar Joey Hess <joey@kitenet.net>2013-05-11 19:14:30 -0400
commitcbc98eee9d583f56d52a70fbff7abe171a1ecebe (patch)
tree90dacacdd69cbeb1770c48471d40fc3892c51217 /Test.hs
parent618af8b6772d25ab27336d240ecddae7ae207561 (diff)
use setCurrentDirectory
On POSIX, this just calls changeWorkingDirectory.
Diffstat (limited to 'Test.hs')
-rwxr-xr-xTest.hs9
1 files changed, 4 insertions, 5 deletions
diff --git a/Test.hs b/Test.hs
index 061fcb362..c1f82d171 100755
--- a/Test.hs
+++ b/Test.hs
@@ -11,7 +11,6 @@ import Test.HUnit
import Test.QuickCheck
import Test.QuickCheck.Test
-import System.Posix.Directory (changeWorkingDirectory)
import System.Posix.Files
import Control.Exception.Extensible
import qualified Data.Map as M
@@ -199,7 +198,7 @@ test_add = "git-annex add" ~: TestList [basic, sha1dup, subdirs]
git_annex "add" ["dir"] @? "add of subdir failed"
createDirectory "dir2"
writeFile "dir2/foo" $ content annexedfile
- changeWorkingDirectory "dir"
+ setCurrentDirectory "dir"
git_annex "add" ["../dir2"] @? "add of ../subdir failed"
test_reinject :: Test
@@ -814,7 +813,7 @@ indir dir a = do
-- Assertion failures throw non-IO errors; catch
-- any type of error and change back to cwd before
-- rethrowing.
- r <- bracket_ (changeToTmpDir dir) (changeWorkingDirectory cwd)
+ r <- bracket_ (changeToTmpDir dir) (setCurrentDirectory cwd)
(try (a)::IO (Either SomeException ()))
case r of
Right () -> return ()
@@ -949,7 +948,7 @@ prepare = do
cwd <- getCurrentDirectory
p <- Utility.Env.getEnvDefault "PATH" ""
void $ Utility.Env.setEnv "PATH" (cwd ++ ":" ++ p) True
- void $Utility.Env.setEnv "TOPDIR" cwd True
+ void $ Utility.Env.setEnv "TOPDIR" cwd True
-- Avoid git complaining if it cannot determine the user's email
-- address, or exploding if it doesn't know the user's name.
void $ Utility.Env.setEnv "GIT_AUTHOR_EMAIL" "test@example.com" True
@@ -961,7 +960,7 @@ changeToTmpDir :: FilePath -> IO ()
changeToTmpDir t = do
-- Hack alert. Threading state to here was too much bother.
topdir <- Utility.Env.getEnvDefault "TOPDIR" ""
- changeWorkingDirectory $ topdir ++ "/" ++ t
+ setCurrentDirectory $ topdir ++ "/" ++ t
tmpdir :: String
tmpdir = ".t"