[commit: packages/directory] master: Migrate test: GetHomeDirectory001 (338bb10)

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


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

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/338bb108159439b3d26f3a6bbcf257c8927d3291/directory

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

commit 338bb108159439b3d26f3a6bbcf257c8927d3291
Author: Phil Ruffwind <rf at rufflewind.com>
Date:   Fri Jun 5 02:55:51 2015 -0400

    Migrate test: GetHomeDirectory001


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

338bb108159439b3d26f3a6bbcf257c8927d3291
 tests/GetHomeDirectory001.hs | 16 ++++++++++++++++
 tests/Main.hs                |  2 ++
 tests/all.T                  |  3 ---
 tests/getHomeDirectory001.hs |  8 --------
 4 files changed, 18 insertions(+), 11 deletions(-)

diff --git a/tests/GetHomeDirectory001.hs b/tests/GetHomeDirectory001.hs
new file mode 100644
index 0000000..68bf343
--- /dev/null
+++ b/tests/GetHomeDirectory001.hs
@@ -0,0 +1,16 @@
+{-# LANGUAGE CPP #-}
+module GetHomeDirectory001 where
+#include "util.inl"
+import System.Directory
+
+main :: TestEnv -> IO ()
+main _t = do
+  homeDir <- getHomeDirectory
+  T(expect) () (homeDir /= "") -- sanity check
+  _ <- getAppUserDataDirectory   "test"
+  _ <- getXdgDirectory XdgCache  "test"
+  _ <- getXdgDirectory XdgConfig "test"
+  _ <- getXdgDirectory XdgData   "test"
+  _ <- getUserDocumentsDirectory
+  _ <- getTemporaryDirectory
+  return ()
diff --git a/tests/Main.hs b/tests/Main.hs
index fa686d1..d4e0a4d 100644
--- a/tests/Main.hs
+++ b/tests/Main.hs
@@ -11,6 +11,7 @@ import qualified DoesDirectoryExist001
 import qualified FileTime
 import qualified GetDirContents001
 import qualified GetDirContents002
+import qualified GetHomeDirectory001
 import qualified GetPermissions001
 import qualified RenameFile001
 import qualified T8482
@@ -28,6 +29,7 @@ main = T.testMain $ \ _t -> do
   T.isolatedRun _t "FileTime" FileTime.main
   T.isolatedRun _t "GetDirContents001" GetDirContents001.main
   T.isolatedRun _t "GetDirContents002" GetDirContents002.main
+  T.isolatedRun _t "GetHomeDirectory001" GetHomeDirectory001.main
   T.isolatedRun _t "GetPermissions001" GetPermissions001.main
   T.isolatedRun _t "RenameFile001" RenameFile001.main
   T.isolatedRun _t "T8482" T8482.main
diff --git a/tests/all.T b/tests/all.T
index afbb52c..13d6ce9 100644
--- a/tests/all.T
+++ b/tests/all.T
@@ -1,4 +1 @@
-# No sane way to tell whether the output is reasonable here...
-test('getHomeDirectory001',  ignore_output, compile_and_run, [''])
-
 test('removeDirectoryRecursive001', normal, compile_and_run, [''])
diff --git a/tests/getHomeDirectory001.hs b/tests/getHomeDirectory001.hs
deleted file mode 100644
index ab3eae7..0000000
--- a/tests/getHomeDirectory001.hs
+++ /dev/null
@@ -1,8 +0,0 @@
-import System.Directory
-
-main = do
-  getHomeDirectory               >>= print
-  getAppUserDataDirectory "test" >>= print
-  getUserDocumentsDirectory      >>= print
-  getTemporaryDirectory          >>= print
-  return ()



More information about the ghc-commits mailing list