[commit: packages/directory] master: Migrate test: CreateDirectory001 (7398d8c)

git at git.haskell.org git at git.haskell.org
Fri Dec 18 09:51:41 UTC 2015


Repository : ssh://git@git.haskell.org/directory

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/7398d8cfca4c7b3bd29f082cc2db785131d41917/directory

>---------------------------------------------------------------

commit 7398d8cfca4c7b3bd29f082cc2db785131d41917
Author: Phil Ruffwind <rf at rufflewind.com>
Date:   Fri Jun 5 01:45:08 2015 -0400

    Migrate test: CreateDirectory001


>---------------------------------------------------------------

7398d8cfca4c7b3bd29f082cc2db785131d41917
 tests/CreateDirectory001.hs             | 11 +++++++++++
 tests/Main.hs                           |  2 ++
 tests/all.T                             |  2 --
 tests/createDirectory001.hs             | 12 ------------
 tests/createDirectory001.stdout         |  1 -
 tests/createDirectory001.stdout-mingw32 |  1 -
 6 files changed, 13 insertions(+), 16 deletions(-)

diff --git a/tests/CreateDirectory001.hs b/tests/CreateDirectory001.hs
new file mode 100644
index 0000000..6047ef7
--- /dev/null
+++ b/tests/CreateDirectory001.hs
@@ -0,0 +1,11 @@
+{-# LANGUAGE CPP #-}
+module CreateDirectory001 where
+#include "util.inl"
+import System.Directory
+import System.IO.Error (isAlreadyExistsError)
+
+main :: TestEnv -> IO ()
+main _t = do
+  createDirectory testdir
+  T(expectIOErrorType) () isAlreadyExistsError (createDirectory testdir)
+  where testdir = "dir"
diff --git a/tests/Main.hs b/tests/Main.hs
index 3596e24..80a7fac 100644
--- a/tests/Main.hs
+++ b/tests/Main.hs
@@ -3,6 +3,7 @@ import qualified Util as T
 import qualified CanonicalizePath
 import qualified CopyFile001
 import qualified CopyFile002
+import qualified CreateDirectory001
 import qualified CurrentDirectory001
 import qualified Directory001
 import qualified DoesDirectoryExist001
@@ -18,6 +19,7 @@ main = T.testMain $ \ _t -> do
   T.isolatedRun _t "CanonicalizePath" CanonicalizePath.main
   T.isolatedRun _t "CopyFile001" CopyFile001.main
   T.isolatedRun _t "CopyFile002" CopyFile002.main
+  T.isolatedRun _t "CreateDirectory001" CreateDirectory001.main
   T.isolatedRun _t "CurrentDirectory001" CurrentDirectory001.main
   T.isolatedRun _t "Directory001" Directory001.main
   T.isolatedRun _t "DoesDirectoryExist001" DoesDirectoryExist001.main
diff --git a/tests/all.T b/tests/all.T
index ba53243..33de32c 100644
--- a/tests/all.T
+++ b/tests/all.T
@@ -1,5 +1,3 @@
-test('createDirectory001',  normal, compile_and_run, [''])
-
 test('createDirectoryIfMissing001',  normal, compile_and_run, [''])
 
 # No sane way to tell whether the output is reasonable here...
diff --git a/tests/createDirectory001.hs b/tests/createDirectory001.hs
deleted file mode 100644
index 9c718da..0000000
--- a/tests/createDirectory001.hs
+++ /dev/null
@@ -1,12 +0,0 @@
-import System.Directory
-import Control.Exception
-
-testdir = "createDirectory001.dir"
-
-main = do
-  try (removeDirectory testdir) :: IO (Either IOException ())
-  createDirectory testdir
-  r <- try $ createDirectory testdir
-  print (r :: Either IOException ()) -- already exists
-  removeDirectory testdir
-
diff --git a/tests/createDirectory001.stdout b/tests/createDirectory001.stdout
deleted file mode 100644
index a4c46ee..0000000
--- a/tests/createDirectory001.stdout
+++ /dev/null
@@ -1 +0,0 @@
-Left createDirectory001.dir: createDirectory: already exists (File exists)
diff --git a/tests/createDirectory001.stdout-mingw32 b/tests/createDirectory001.stdout-mingw32
deleted file mode 100644
index b295f14..0000000
--- a/tests/createDirectory001.stdout-mingw32
+++ /dev/null
@@ -1 +0,0 @@
-Left CreateDirectory "createDirectory001.dir": already exists (Cannot create a file when that file already exists.)



More information about the ghc-commits mailing list