Move tests from testsuite/tests/ghc-regress/lib/Directory
[haskell-directory.git] / tests / currentDirectory001.hs
1 import Directory (getCurrentDirectory, setCurrentDirectory, 
2                      createDirectory, removeDirectory, getDirectoryContents)
3
4 main = do
5     oldpwd <- getCurrentDirectory
6     createDirectory "foo"
7     setCurrentDirectory "foo"
8     ~[n1, n2] <- getDirectoryContents "."
9     if dot n1 && dot n2 
10      then do
11         setCurrentDirectory oldpwd
12         removeDirectory "foo"
13         putStr "Okay\n"
14       else
15         ioError (userError "Oops")
16
17 dot :: String -> Bool
18 dot "." = True
19 dot ".." = True
20 dot _ = False