[Pkg-haskell-commits] [SCM] haskell-testpack branch, master, updated. debian/1.0.2-1-4-gb0d6b36
John Goerzen
jgoerzen at complete.org
Fri Apr 23 15:01:14 UTC 2010
The following commit has been merged in the master branch:
commit 041716ada06ea1088225d60e4698404b49668f9f
Author: John Goerzen <jgoerzen at complete.org>
Date: Fri Jul 22 22:17:45 2005 +0100
Tidied up some docs and made the tests use PlafCompat
diff --git a/MissingH/IO/PlafCompat.hs b/MissingH/IO/PlafCompat.hs
index d465941..d76e1b2 100644
--- a/MissingH/IO/PlafCompat.hs
+++ b/MissingH/IO/PlafCompat.hs
@@ -27,8 +27,11 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Stability : provisional
Portability: portable
-Exports appropriate System.Posix.* or "MissingH.IO.WindowsCompat" information,
-plus some additional generic platform data.
+On Unix, exports System.Posix.Types and System.Posix.Files.
+
+On Windows, exports System.Posix.Types and "MissingH.IO.WindowsCompat".
+
+The result should be roughly the same set of defined variables and types.
-}
@@ -48,4 +51,13 @@ import MissingH.IO.WindowsCompat
#else
import System.Posix.Files
#endif
-import MissingH.IO.PosixConsts
+
+{- | The name of the null device. NUL: on Windows, /dev/null everywhere else.
+-}
+
+nullFileName :: String
+#ifdef mingw32_HOST_OS
+nullFileName = "NUL:"
+#else
+nullFileName = "/dev/null"
+#endif
diff --git a/MissingH/IO/PosixConsts.hs b/MissingH/IO/PosixConsts.hs
index 1e2a1ee..62836e1 100644
--- a/MissingH/IO/PosixConsts.hs
+++ b/MissingH/IO/PosixConsts.hs
@@ -32,6 +32,10 @@ by default.
-}
+module MissingH.IO.PosixConsts where
+import System.Posix.Types
+import Data.Bits
+
blockSpecialMode :: FileMode
blockSpecialMode = 0o0060000
diff --git a/MissingH/IO/WindowsCompat.hs b/MissingH/IO/WindowsCompat.hs
index e1a57e1..a32daea 100644
--- a/MissingH/IO/WindowsCompat.hs
+++ b/MissingH/IO/WindowsCompat.hs
@@ -51,6 +51,9 @@ Common usage might be like this:
>import System.Posix.Files
>#endif
+Or, to avoid having to use CPP and make things even easier, just import
+"MissingH.IO.PlafCompat", which essentially does the above.
+
-}
module MissingH.IO.WindowsCompat
diff --git a/testsrc/ConfigParser/Maintest.hs b/testsrc/ConfigParser/Maintest.hs
index 7e79432..310169d 100644
--- a/testsrc/ConfigParser/Maintest.hs
+++ b/testsrc/ConfigParser/Maintest.hs
@@ -20,15 +20,12 @@ module ConfigParser.Maintest(tests) where
import Test.HUnit
import MissingH.ConfigParser
import MissingH.Either
+import MissingH.IO.PlafCompat(nullFileName)
import Testutil
import Control.Exception
import System.IO
-#ifndef mingw32_HOST_OS
-nullfile = openFile "/dev/null" ReadWriteMode
-#else
-nullfile = openFile "NUL:" ReadWriteMode
-#endif
+nullfile = openFile nullFileName ReadWriteMode
testfile = "testsrc/ConfigParser/test.cfg"
p inp = forceEither $ readstring emptyCP inp
f msg inp exp conv = TestLabel msg $ TestCase $ assertEqual "" (Right exp) (conv (p inp))
--
haskell-testpack
More information about the Pkg-haskell-commits
mailing list