Fix these tests
authorSimon Marlow <marlowsd@gmail.com>
Sat, 27 Sep 2008 13:31:11 +0000 (13:31 +0000)
committerSimon Marlow <marlowsd@gmail.com>
Sat, 27 Sep 2008 13:31:11 +0000 (13:31 +0000)
tests/copyFile001.hs
tests/copyFile002.hs
tests/createDirectory001.stdout
tests/createDirectory001.stdout-i386-unknown-mingw32 [new file with mode: 0644]

index e279dd0..e039bec 100644 (file)
@@ -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"
index ff42d67..222192b 100644 (file)
@@ -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"
index d3a37b8..a4c46ee 100644 (file)
@@ -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 (file)
index 0000000..d3a37b8
--- /dev/null
@@ -0,0 +1 @@
+Left CreateDirectory: already exists (Cannot create a file when that file already exists.)