From: Simon Marlow Date: Thu, 18 Oct 2007 13:06:23 +0000 (+0000) Subject: add test for #1652 X-Git-Tag: 2008-05-28~8 X-Git-Url: http://git.megacz.com/?p=haskell-directory.git;a=commitdiff_plain;h=70a84e093a384469b229afc8cca3004ce4971586 add test for #1652 --- diff --git a/tests/all.T b/tests/all.T index 1c34882..633a8d8 100644 --- a/tests/all.T +++ b/tests/all.T @@ -9,3 +9,4 @@ test('getDirContents001', omit_ways(['ghci']), compile_and_run, ['-fno-gen-manif test('getPermissions001', omit_ways(['ghci']), compile_and_run, ['-cpp']) test('copyFile001', normal, compile_and_run, ['']) +test('copyFile002', normal, compile_and_run, ['']) diff --git a/tests/copyFile002.hs b/tests/copyFile002.hs new file mode 100644 index 0000000..332d762 --- /dev/null +++ b/tests/copyFile002.hs @@ -0,0 +1,28 @@ + +module Main (main) where + +import Control.Exception +import Data.List +import System.Directory +import System.IO + +-- like copyFile001, but moves a file in the current directory +-- See bug #1652 +main :: IO () +main = do d <- getCurrentDirectory + flip finally (setCurrentDirectory d) $ do + setCurrentDirectory "copyFile" + try $ removeFile to + cs_before <- getDirectoryContents "." + putStrLn "Before:" + print $ sort cs_before + copyFile from to + cs_before <- getDirectoryContents "." + putStrLn "After:" + print $ sort cs_before + readFile to >>= print + +from, to :: FilePath +from = "source" +to = "target" + diff --git a/tests/copyFile002.stdout b/tests/copyFile002.stdout new file mode 100644 index 0000000..6b17d94 --- /dev/null +++ b/tests/copyFile002.stdout @@ -0,0 +1,5 @@ +Before: +[".","..","source"] +After: +[".","..","source","target"] +"This is the data"