add test for #1652
[haskell-directory.git] / tests / copyFile002.hs
1
2 module Main (main) where
3
4 import Control.Exception
5 import Data.List
6 import System.Directory
7 import System.IO
8
9 -- like copyFile001, but moves a file in the current directory
10 -- See bug #1652
11 main :: IO ()
12 main = do d <- getCurrentDirectory
13           flip finally (setCurrentDirectory d) $ do
14           setCurrentDirectory "copyFile"
15           try $ removeFile to
16           cs_before <- getDirectoryContents "."
17           putStrLn "Before:"
18           print $ sort cs_before
19           copyFile from to
20           cs_before <- getDirectoryContents "."
21           putStrLn "After:"
22           print $ sort cs_before
23           readFile to >>= print
24
25 from, to :: FilePath
26 from = "source"
27 to   = "target"
28