[commit: packages/directory] master: Fix the tests for older versions of GHC (e856866)
git at git.haskell.org
git at git.haskell.org
Thu Mar 19 11:38:21 UTC 2015
Repository : ssh://git@git.haskell.org/directory
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/e856866d6a46a910c3b297ca8c5e6198860f9fec/directory
>---------------------------------------------------------------
commit e856866d6a46a910c3b297ca8c5e6198860f9fec
Author: Phil Ruffwind <rf at rufflewind.com>
Date: Tue Mar 3 06:10:50 2015 -0500
Fix the tests for older versions of GHC
>---------------------------------------------------------------
e856866d6a46a910c3b297ca8c5e6198860f9fec
tests/canonicalizePath001.hs | 8 +++-----
tests/createDirectoryIfMissing001.hs | 6 +++---
2 files changed, 6 insertions(+), 8 deletions(-)
diff --git a/tests/canonicalizePath001.hs b/tests/canonicalizePath001.hs
index dc21cd8..2c66a71 100644
--- a/tests/canonicalizePath001.hs
+++ b/tests/canonicalizePath001.hs
@@ -1,10 +1,8 @@
-module Main(main) where
-
-import Control.Exception
+module Main (main) where
import System.Directory
+import System.IO.Error (catchIOError)
main = do
dot <- canonicalizePath "."
- nul <- (canonicalizePath "")
- `catch` ((\_ -> return "") :: IOException -> IO String)
+ nul <- canonicalizePath "" `catchIOError` \ _ -> return ""
print (dot == nul)
diff --git a/tests/createDirectoryIfMissing001.hs b/tests/createDirectoryIfMissing001.hs
index bd80761..b99e5a1 100644
--- a/tests/createDirectoryIfMissing001.hs
+++ b/tests/createDirectoryIfMissing001.hs
@@ -2,7 +2,7 @@ module Main(main) where
import Control.Concurrent
import Control.Monad
-import Control.Exception
+import Control.Exception as E
import System.Directory
import System.FilePath
import System.IO.Error
@@ -66,14 +66,14 @@ cleanup = ignore $ removeDirectoryRecursive testdir
report :: Show a => IO a -> IO ()
report io = do
- r <- try io
+ r <- E.try io
case r of
Left e -> print (e :: SomeException)
Right a -> print a
ignore :: IO a -> IO ()
ignore io = do
- r <- try io
+ r <- E.try io
case r of
Left e -> let _ = e :: SomeException in return ()
Right a -> return ()
More information about the ghc-commits
mailing list