Make currentDirectory001 not conflict with other tests running in parallel
[haskell-directory.git] / tests / currentDirectory001.hs
1
2 import System.Directory (getCurrentDirectory, setCurrentDirectory,
3                          createDirectory, removeDirectory,
4                          getDirectoryContents)
5
6 main :: IO ()
7 main = do
8     oldpwd <- getCurrentDirectory
9     createDirectory dir
10     setCurrentDirectory dir
11     ~[n1, n2] <- getDirectoryContents "."
12     if dot n1 && dot n2 
13      then do
14         setCurrentDirectory oldpwd
15         removeDirectory dir
16         putStr "Okay\n"
17       else
18         ioError (userError "Oops")
19
20 dot :: String -> Bool
21 dot "." = True
22 dot ".." = True
23 dot _ = False
24
25 dir :: FilePath
26 dir = "currentDirectory001-dir"
27