[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:43:11 UTC 2010


The following commit has been merged in the master branch:
commit 89827258561237fbc091e98f77120327b98a579d
Author: John Goerzen <jgoerzen at complete.org>
Date:   Thu Oct 7 08:16:05 2004 +0100

    Added test utilities and first string test
    
    Keywords:
    
    
    (jgoerzen at complete.org--projects/missingh--head--1.0--patch-38)

diff --git a/ChangeLog b/ChangeLog
index c44ca1a..37d9fa4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,21 @@
 # arch-tag: automatic-ChangeLog--jgoerzen at complete.org--projects/missingh--head--1.0
 #
 
+2004-10-07 02:16:05 GMT	John Goerzen <jgoerzen at complete.org>	patch-38
+
+    Summary:
+      Added test utilities and first string test
+    Revision:
+      missingh--head--1.0--patch-38
+
+
+    new files:
+     testsrc/Strtest.hs testsrc/Testutil.hs
+
+    modified files:
+     ChangeLog testsrc/Tests.hs
+
+
 2004-10-07 02:06:13 GMT	John Goerzen <jgoerzen at complete.org>	patch-37
 
     Summary:
diff --git a/testsrc/Tests.hs b/testsrc/Strtest.hs
similarity index 61%
copy from testsrc/Tests.hs
copy to testsrc/Strtest.hs
index 8a90990..b456579 100644
--- a/testsrc/Tests.hs
+++ b/testsrc/Strtest.hs
@@ -1,4 +1,4 @@
-{- arch-tag: Tests main file
+{- arch-tag: Str 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,13 +16,23 @@ along with this program; if not, write to the Free Software
 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 -}
 
-module Tests(tests) where
+module Strtest(tests) where
 import HUnit
-import qualified Listtest
+import MissingH.Str
+import Testutil
+
+test_lstrip =
+    mapassertEqual "lstrip" lstrip
+                       [("", ""),
+                        ("a", "a"),
+                        (" a ", "a "),
+                        ("  abas", "abas"),
+                        ("\n\t fdsa", "fdsa"),
+                        ("abc def", "abc def")]
+
+tests = TestList [TestLabel "lstrip" (TestCase test_lstrip)
+                  ]
 
-test1 = TestCase ("x" @=? "x")
 
-tests = TestList [TestLabel "test1" test1,
-                 TestLabel "List" Listtest.tests]
 
 
diff --git a/testsrc/Tests.hs b/testsrc/Tests.hs
index 8a90990..0916b67 100644
--- a/testsrc/Tests.hs
+++ b/testsrc/Tests.hs
@@ -19,10 +19,12 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 module Tests(tests) where
 import HUnit
 import qualified Listtest
+import qualified Strtest
 
 test1 = TestCase ("x" @=? "x")
 
 tests = TestList [TestLabel "test1" test1,
-                 TestLabel "List" Listtest.tests]
+                 TestLabel "List" Listtest.tests,
+                 TestLabel "Str" Strtest.tests]
 
 
diff --git a/testsrc/Tests.hs b/testsrc/Testutil.hs
similarity index 70%
copy from testsrc/Tests.hs
copy to testsrc/Testutil.hs
index 8a90990..5eceef9 100644
--- a/testsrc/Tests.hs
+++ b/testsrc/Testutil.hs
@@ -1,4 +1,4 @@
-{- arch-tag: Tests main file
+{- arch-tag: Test utilities
 Copyright (C) 2004 John Goerzen <jgoerzen at complete.org>
 
 This program is free software; you can redistribute it and/or modify
@@ -16,13 +16,13 @@ along with this program; if not, write to the Free Software
 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 -}
 
-module Tests(tests) where
+module Testutil(mapassertEqual) where
 import HUnit
-import qualified Listtest
-
-test1 = TestCase ("x" @=? "x")
-
-tests = TestList [TestLabel "test1" test1,
-                 TestLabel "List" Listtest.tests]
 
+mapassertEqual :: (Show b, Eq b) => String -> (a -> b) -> [(a, b)] -> Assertion
+mapassertEqual descrip func [] = return ()
+mapassertEqual descrip func ((inp,result):xs) = 
+    do
+    assertEqual descrip result (func inp)
+    mapassertEqual descrip func xs
 

-- 
haskell-testpack



More information about the Pkg-haskell-commits mailing list