[Pkg-haskell-commits] [SCM] haskell-testpack branch, master, updated. debian/1.0.2-1-4-gb0d6b36
gwern0
gwern0 at gmail.com
Fri Apr 23 15:22:07 UTC 2010
The following commit has been merged in the master branch:
commit e45f01b91ed96421d2cb84a06160b62a62419160
Author: gwern0 <gwern0 at gmail.com>
Date: Fri Nov 30 12:08:08 2007 +0100
partial -Wall for Test.HUnit.Uti;
diff --git a/src/Test/HUnit/Utils.hs b/src/Test/HUnit/Utils.hs
index 7a2cfa1..2a97de2 100644
--- a/src/Test/HUnit/Utils.hs
+++ b/src/Test/HUnit/Utils.hs
@@ -30,16 +30,14 @@ Utilities for HUnit unit testing.
Written by John Goerzen, jgoerzen\@complete.org
-}
-
-
-module Test.HUnit.Utils(assertRaises, mapassertEqual, qccheck, qctest) where
+module Test.HUnit.Utils (assertRaises, mapassertEqual, qccheck, qctest)
+ where
import Test.HUnit
import Test.QuickCheck as QC
import qualified Control.Exception
import System.Random
{- | Asserts that a specific exception is raised by a given action. -}
-
assertRaises :: Show a => String -> Control.Exception.Exception -> IO a -> IO ()
assertRaises msg selector action =
let thetest e = if e == selector then return ()
@@ -49,18 +47,17 @@ assertRaises msg selector action =
r <- Control.Exception.try action
case r of
Left e -> thetest e
- Right x -> assertFailure $ msg ++ "\nReceived no exception, but was expecting exception: " ++ (show selector)
+ Right _ -> assertFailure $ msg ++ "\nReceived no exception, but was expecting exception: " ++ (show selector)
mapassertEqual :: (Show b, Eq b) => String -> (a -> b) -> [(a, b)] -> [Test]
-mapassertEqual descrip func [] = []
+mapassertEqual _ _ [] = []
mapassertEqual descrip func ((inp,result):xs) =
(TestCase $ assertEqual descrip result (func inp)) : mapassertEqual descrip func xs
-- * Turn QuickCheck tests into HUnit tests
-
--- |qccheck turns the quickcheck test into an hunit test
-qccheck :: (QC.Testable a) =>
- Config -- ^ quickcheck config
+-- | qccheck turns the quickcheck test into an hunit test
+qccheck :: (QC.Testable a) =>
+ QC.Config -- ^ quickcheck config
-> String -- ^ label for the property
-> a -- ^ quickcheck property
-> Test
@@ -69,14 +66,14 @@ qccheck config lbl property =
do rnd <- newStdGen
tests config (evaluate property) rnd 0 0 []
--- |qctest is equivalent to 'qccheck defaultConfig'
+-- | qctest is equivalent to 'qccheck defaultConfig'
qctest :: (QC.Testable a) => String -> a -> Test
-qctest lbl property = qccheck defaultConfig lbl property
+qctest lbl = qccheck defaultConfig lbl
--- |modified version of the tests function from Test.QuickCheck
-tests :: Config -> Gen Result -> StdGen -> Int -> Int -> [[String]] -> IO ()
+-- | modified version of the tests function from Test.QuickCheck
+tests :: Config -> Gen Result -> StdGen -> Int -> Int -> [[String]] -> IO ()
tests config gen rnd0 ntest nfail stamps
- | ntest == configMaxTest config = return ()
+ | ntest == configMaxTest config = return ()
| nfail == configMaxFail config = assertFailure $ "Arguments exhausted after " ++ show ntest ++ " tests."
| otherwise =
do putStr (configEvery config ntest (arguments result))
--
haskell-testpack
More information about the Pkg-haskell-commits
mailing list