[commit: packages/directory] master: Migrate test: RenameFile001 (d5f3d7e)
git at git.haskell.org
git at git.haskell.org
Fri Dec 18 09:51:39 UTC 2015
Repository : ssh://git@git.haskell.org/directory
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/d5f3d7e793dc2780928dc22a4e477b4aa4c4c02e/directory
>---------------------------------------------------------------
commit d5f3d7e793dc2780928dc22a4e477b4aa4c4c02e
Author: Phil Ruffwind <rf at rufflewind.com>
Date: Fri Jun 5 01:41:18 2015 -0400
Migrate test: RenameFile001
>---------------------------------------------------------------
d5f3d7e793dc2780928dc22a4e477b4aa4c4c02e
tests/Main.hs | 2 ++
tests/RenameFile001.hs | 18 ++++++++++++++++++
tests/all.T | 3 ---
tests/renameFile001.hs | 13 -------------
tests/renameFile001.stdout | 2 --
5 files changed, 20 insertions(+), 18 deletions(-)
diff --git a/tests/Main.hs b/tests/Main.hs
index c72d022..3596e24 100644
--- a/tests/Main.hs
+++ b/tests/Main.hs
@@ -10,6 +10,7 @@ import qualified FileTime
import qualified GetDirContents001
import qualified GetDirContents002
import qualified GetPermissions001
+import qualified RenameFile001
import qualified T8482
main :: IO ()
@@ -24,4 +25,5 @@ main = T.testMain $ \ _t -> do
T.isolatedRun _t "GetDirContents001" GetDirContents001.main
T.isolatedRun _t "GetDirContents002" GetDirContents002.main
T.isolatedRun _t "GetPermissions001" GetPermissions001.main
+ T.isolatedRun _t "RenameFile001" RenameFile001.main
T.isolatedRun _t "T8482" T8482.main
diff --git a/tests/RenameFile001.hs b/tests/RenameFile001.hs
new file mode 100644
index 0000000..f20bfb7
--- /dev/null
+++ b/tests/RenameFile001.hs
@@ -0,0 +1,18 @@
+{-# LANGUAGE CPP #-}
+module RenameFile001 where
+#include "util.inl"
+import System.Directory
+
+main :: TestEnv -> IO ()
+main _t = do
+ writeFile tmp1 contents1
+ renameFile tmp1 tmp2
+ T(expectEq) () contents1 =<< readFile tmp2
+ writeFile tmp1 contents2
+ renameFile tmp2 tmp1
+ T(expectEq) () contents1 =<< readFile tmp1
+ where
+ tmp1 = "tmp1"
+ tmp2 = "tmp2"
+ contents1 = "test"
+ contents2 = "test2"
diff --git a/tests/all.T b/tests/all.T
index 90e87d1..ba53243 100644
--- a/tests/all.T
+++ b/tests/all.T
@@ -1,6 +1,3 @@
-test('renameFile001', extra_clean(['renameFile001.tmp1','renameFile001.tmp2']),
- compile_and_run, [''])
-
test('createDirectory001', normal, compile_and_run, [''])
test('createDirectoryIfMissing001', normal, compile_and_run, [''])
diff --git a/tests/renameFile001.hs b/tests/renameFile001.hs
deleted file mode 100644
index 2bbdb8c..0000000
--- a/tests/renameFile001.hs
+++ /dev/null
@@ -1,13 +0,0 @@
-import System.Directory
-
-tmp1 = "renameFile001.tmp1"
-tmp2 = "renameFile001.tmp2"
-
-main = do
- writeFile tmp1 "test"
- renameFile tmp1 tmp2
- readFile tmp2 >>= print
- writeFile tmp1 "test2"
- renameFile tmp2 tmp1
- readFile tmp1 >>= print
-
diff --git a/tests/renameFile001.stdout b/tests/renameFile001.stdout
deleted file mode 100644
index 6449f83..0000000
--- a/tests/renameFile001.stdout
+++ /dev/null
@@ -1,2 +0,0 @@
-"test"
-"test"
More information about the ghc-commits
mailing list