[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 14:51:50 UTC 2010
The following commit has been merged in the master branch:
commit 13c31789235261bef5c91c7635fb19986fd3a68c
Author: John Goerzen <jgoerzen at complete.org>
Date: Tue Dec 21 00:01:25 2004 +0100
Disabled vShow; apparently hShow is unsupported in Hugs
Keywords:
(jgoerzen at complete.org--projects/missingh--head--0.7--patch-98)
diff --git a/ChangeLog b/ChangeLog
index fc6a3dc..c0e5c14 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,22 @@
# arch-tag: automatic-ChangeLog--jgoerzen at complete.org--projects/missingh--head--0.7
#
+2004-12-20 17:01:25 GMT John Goerzen <jgoerzen at complete.org> patch-98
+
+ Summary:
+ Disabled vShow; apparently hShow is unsupported in Hugs
+ Revision:
+ missingh--head--0.7--patch-98
+
+
+ new files:
+ libsrc/MissingH/IO/HVFS/InstanceHelpers.hs testsrc/HVIOtest.hs
+
+ modified files:
+ ChangeLog libsrc/MissingH/IO/HVFS.hs
+ libsrc/MissingH/IO/HVIO.hs testsrc/Tests.hs
+
+
2004-12-20 16:33:42 GMT John Goerzen <jgoerzen at complete.org> patch-97
Summary:
diff --git a/libsrc/MissingH/IO/HVFS.hs b/libsrc/MissingH/IO/HVFS.hs
index a61200d..e418110 100644
--- a/libsrc/MissingH/IO/HVFS.hs
+++ b/libsrc/MissingH/IO/HVFS.hs
@@ -49,6 +49,12 @@ import System.Posix.Types
import System.Time
import System.Directory
+{- | Encapsulate a 'HVFSStat' result. This is required due to Haskell
+typing restrictions. You can get at it with:
+
+> case encap of
+> HVFSStatEncap x -> -- now use x
+-}
data HVFSStatEncap = forall a. HVFSStat a => HVFSStatEncap a
{- | Evaluating types of files and information about them.
diff --git a/libsrc/MissingH/IO/HVFS/InstanceHelpers.hs b/libsrc/MissingH/IO/HVFS/InstanceHelpers.hs
new file mode 100644
index 0000000..cc567e3
--- /dev/null
+++ b/libsrc/MissingH/IO/HVFS/InstanceHelpers.hs
@@ -0,0 +1,57 @@
+{- arch-tag: HVFS instance helpers
+Copyright (C) 2004 John Goerzen <jgoerzen at complete.org>
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+-}
+
+{- |
+ Module : MissingH.IO.HVFS.InstanceHelpers
+ Copyright : Copyright (C) 2004 John Goerzen
+ License : GNU GPL, version 2 or above
+
+ Maintainer : John Goerzen,
+ Maintainer : jgoerzen at complete.org
+ Stability : provisional
+ Portability: portable
+
+Utilities for creating instances of the items defined in
+"MissingH.IO.HVFS".
+
+Copyright (c) 2004 John Goerzen, jgoerzen\@complete.org
+-}
+
+module MissingH.IO.HVFS.InstanceHelpers(-- * HVFSStat objects
+ SimpleStat,
+ -- * HVFS objects & types
+
+ )
+where
+import MissingH.IO.HVFS
+
+{- | A simple class that assumes that everything is either a file
+or a directory. -}
+data SimpleStat = SimpleStat {
+ isFile :: Bool -- ^ True if file, False if directory
+ } deriving (Show, Eq)
+instance HVFSStat SimpleStat where
+ vIsRegularFile x = isFile x
+ vIsDirectory x = not (isFile x)
+
+----------------------------------------------------------------------
+-- In-Memory Tree Types
+----------------------------------------------------------------------
+
+data MemoryNode = MemoryFile String String -- ^ A file, defined by its name and contents
+ | MemoryDirectory String [MemoryNode] -- ^ A directory, defined by its name and list of component files
diff --git a/libsrc/MissingH/IO/HVIO.hs b/libsrc/MissingH/IO/HVIO.hs
index 6200a23..cb90883 100644
--- a/libsrc/MissingH/IO/HVIO.hs
+++ b/libsrc/MissingH/IO/HVIO.hs
@@ -364,7 +364,7 @@ class (HVIOGeneric a) => HVIOSeeker a where
instance HVIOGeneric Handle where
vClose = hClose
vIsEOF = hIsEOF
- vShow = hShow
+ --vShow = hShow
vMkIOError h et desc mfp =
mkIOError et desc (Just h) mfp
diff --git a/testsrc/CRC32POSIXtest.hs b/testsrc/HVIOtest.hs
similarity index 54%
copy from testsrc/CRC32POSIXtest.hs
copy to testsrc/HVIOtest.hs
index 8f831fa..702bcb8 100644
--- a/testsrc/CRC32POSIXtest.hs
+++ b/testsrc/HVIOtest.hs
@@ -1,4 +1,4 @@
-{- arch-tag: Tests for CRC-32 module
+{- arch-tag: HVIO tests main file
Copyright (C) 2004 John Goerzen <jgoerzen at complete.org>
This program is free software; you can redistribute it and/or modify
@@ -16,21 +16,25 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-}
-module CRC32POSIXtest(tests) where
+module HVIOtest(tests) where
import HUnit
-import MissingH.Checksum.CRC32.Posix
+import MissingH.IO.HVIO
-test_crc32 =
- let f msg inp exp = TestLabel msg $ TestCase $ assertEqual "" exp (crc32 inp) in
- [
- f "Empty" "" 4294967295,
- f "1" "1" 433426081,
- f "some numbers" "153141341309874102987412" 2083856642,
- f "Some text" "This is a test of the crc32 thing\n" 2449124888
+ioeq :: (Show a, Eq a) => a -> IO a -> Assertion
+ioeq exp inp = do x <- inp
+ exp @=? x
+test_StreamReader =
+ let f inp testfunc = TestLabel inp $ TestCase $ do x <- newStreamReader inp
+ testfunc x
+ in
+ [
+ f "" (\x -> do True `ioeq` vIsEOF x
+ True `ioeq` vIsOpen x
+ vClose x
+ False `ioeq` vIsOpen x
+ )
]
-tests = TestList [TestLabel "crc32" (TestList test_crc32)
-
- ]
-
+tests = TestList [TestLabel "streamReader" (TestList test_StreamReader)
+ ]
\ No newline at end of file
diff --git a/testsrc/Tests.hs b/testsrc/Tests.hs
index 63b40b6..7bf030a 100644
--- a/testsrc/Tests.hs
+++ b/testsrc/Tests.hs
@@ -33,6 +33,7 @@ import qualified ConfigParser.Maintest
import qualified CRC32POSIXtest
import qualified CRC32GZIPtest
import qualified GZiptest
+import qualified HVIOtest
test1 = TestCase ("x" @=? "x")
@@ -41,6 +42,7 @@ tests = TestList [TestLabel "test1" test1,
TestLabel "Str" Strtest.tests,
TestLabel "FiniteMap" FiniteMaptest.tests,
TestLabel "Path" Pathtest.tests,
+ TestLabel "HVIO" HVIOtest.tests,
TestLabel "MIMETypes" MIMETypestest.tests,
TestLabel "Bitstest" Bitstest.tests,
TestLabel "Network.FTP.Parser" Network.FTP.Parsertest.tests,
--
haskell-testpack
More information about the Pkg-haskell-commits
mailing list