From 7f45934b8c30342c42a76fd16738f146724cbfbb Mon Sep 17 00:00:00 2001 From: Simon Marlow Date: Sat, 27 Sep 2008 13:31:11 +0000 Subject: [PATCH 1/1] Fix these tests --- tests/copyFile001.hs | 5 ++++- tests/copyFile002.hs | 5 ++++- tests/createDirectory001.stdout | 2 +- tests/createDirectory001.stdout-i386-unknown-mingw32 | 1 + 4 files changed, 10 insertions(+), 3 deletions(-) create mode 100644 tests/createDirectory001.stdout-i386-unknown-mingw32 diff --git a/tests/copyFile001.hs b/tests/copyFile001.hs index e279dd0..e039bec 100644 --- a/tests/copyFile001.hs +++ b/tests/copyFile001.hs @@ -7,7 +7,7 @@ import System.Directory import System.IO main :: IO () -main = do ignoreExceptions $ removeFile to +main = do tryIO $ removeFile to cs_before <- getDirectoryContents "copyFile" putStrLn "Before:" print $ sort cs_before @@ -17,6 +17,9 @@ main = do ignoreExceptions $ removeFile to print $ sort cs_before readFile to >>= print +tryIO :: IO a -> IO (Either IOException a) +tryIO = try + from, to :: FilePath from = "copyFile/source" to = "copyFile/target" diff --git a/tests/copyFile002.hs b/tests/copyFile002.hs index ff42d67..222192b 100644 --- a/tests/copyFile002.hs +++ b/tests/copyFile002.hs @@ -12,7 +12,7 @@ main :: IO () main = do d <- getCurrentDirectory flip finally (setCurrentDirectory d) $ do setCurrentDirectory "copyFile" - ignoreExceptions $ removeFile to + tryIO $ removeFile to cs_before <- getDirectoryContents "." putStrLn "Before:" print $ sort cs_before @@ -22,6 +22,9 @@ main = do d <- getCurrentDirectory print $ sort cs_before readFile to >>= print +tryIO :: IO a -> IO (Either IOException a) +tryIO = try + from, to :: FilePath from = "source" to = "target" diff --git a/tests/createDirectory001.stdout b/tests/createDirectory001.stdout index d3a37b8..a4c46ee 100644 --- a/tests/createDirectory001.stdout +++ b/tests/createDirectory001.stdout @@ -1 +1 @@ -Left CreateDirectory: already exists (Cannot create a file when that file already exists.) +Left createDirectory001.dir: createDirectory: already exists (File exists) diff --git a/tests/createDirectory001.stdout-i386-unknown-mingw32 b/tests/createDirectory001.stdout-i386-unknown-mingw32 new file mode 100644 index 0000000..d3a37b8 --- /dev/null +++ b/tests/createDirectory001.stdout-i386-unknown-mingw32 @@ -0,0 +1 @@ +Left CreateDirectory: already exists (Cannot create a file when that file already exists.) -- 1.7.10.4