[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:52:13 UTC 2010


The following commit has been merged in the master branch:
commit f40f9182699433411952241b9fadb31e338687f9
Author: John Goerzen <jgoerzen at complete.org>
Date:   Tue Dec 21 04:34:43 2004 +0100

    Checkpointing tests
    
    Keywords:
    
    
    (jgoerzen at complete.org--projects/missingh--head--0.7--patch-110)

diff --git a/ChangeLog b/ChangeLog
index e189f5a..f6f23f7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,21 @@
 # arch-tag: automatic-ChangeLog--jgoerzen at complete.org--projects/missingh--head--0.7
 #
 
+2004-12-20 21:34:43 GMT	John Goerzen <jgoerzen at complete.org>	patch-110
+
+    Summary:
+      Checkpointing tests
+    Revision:
+      missingh--head--0.7--patch-110
+
+
+    new files:
+     testsrc/HVFStest.hs
+
+    modified files:
+     ChangeLog testsrc/Tests.hs
+
+
 2004-12-20 21:20:32 GMT	John Goerzen <jgoerzen at complete.org>	patch-109
 
     Summary:
diff --git a/testsrc/HVFStest.hs b/testsrc/HVFStest.hs
new file mode 100644
index 0000000..8e05e22
--- /dev/null
+++ b/testsrc/HVFStest.hs
@@ -0,0 +1,56 @@
+{- arch-tag: HVFS tests main file
+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 HVFStest(tests) where
+import HUnit
+import MissingH.IO.HVIO
+import MissingH.IO.HVFS
+import MissingH.IO.HVFS.InstanceHelpers
+import Testutil
+import System.IO
+import System.IO.Error
+import Control.Exception
+
+ioeq :: (Show a, Eq a) => a -> IO a -> Assertion
+ioeq exp inp = do x <- inp
+                  exp @=? x
+
+testTree = [("test.txt", MemoryFile "line1\nline2\n"),
+            ("file2.txt", MemoryFile "line3\nline4\n"),
+            ("emptydir", MemoryDirectory []),
+            ("dir1", MemoryDirectory
+             [("file3.txt", MemoryFile "line5\n"),
+              ("test.txt", MemoryFile "subdir test"),
+              ("dir2", MemoryDirectory [])
+             ]
+            )
+           ]
+
+test_structure =
+    let f msg testfunc = TestLabel msg $ TestCase $ do x <- newMemoryVFS testTree
+                                                       testfunc x
+        in
+        [
+         f "root" (\x -> ["test.txt", "file2.txt", "emptydir", "dir1"]
+                         `ioeq` vGetDirectoryContents x "/")
+        ]
+                            
+
+tests = TestList [TestLabel "structure" (TestList test_structure)
+
+                 ]
\ No newline at end of file
diff --git a/testsrc/Tests.hs b/testsrc/Tests.hs
index 7bf030a..54b320b 100644
--- a/testsrc/Tests.hs
+++ b/testsrc/Tests.hs
@@ -34,6 +34,7 @@ import qualified CRC32POSIXtest
 import qualified CRC32GZIPtest
 import qualified GZiptest
 import qualified HVIOtest
+import qualified HVFStest
 
 test1 = TestCase ("x" @=? "x")
 
@@ -43,6 +44,7 @@ tests = TestList [TestLabel "test1" test1,
                  TestLabel "FiniteMap" FiniteMaptest.tests,
                  TestLabel "Path" Pathtest.tests,
                  TestLabel "HVIO" HVIOtest.tests,
+                 TestLabel "HVFS" HVFStest.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