packages feed

HUnit 1.1 → 1.2.0.0

raw patch · 4 files changed

+34/−12 lines, 4 filessetup-changedPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

+ Test.HUnit.Lang: instance Typeable HUnitFailure

Files

HUnit.cabal view
@@ -1,5 +1,5 @@ name:		HUnit-version:	1.1+version:	1.2.0.0 license:	BSD3 license-file:	LICENSE author:		Dean Herington@@ -10,6 +10,7 @@ description: 	HUnit is a unit testing framework for Haskell, inspired by the 	JUnit tool for Java, see: <http://www.junit.org>.+build-type:     Simple exposed-modules: 	Test.HUnit.Base, 	Test.HUnit.Lang,
Setup.hs view
@@ -1,2 +1,6 @@+module Main (main) where+ import Distribution.Simple++main :: IO () main = defaultMain
Test/HUnit/Lang.lhs view
@@ -19,7 +19,8 @@  > import Data.List (isPrefixOf) #if defined(__GLASGOW_HASKELL__) || defined(__HUGS__)-> import Control.Exception (try)+> import Data.Dynamic+> import Control.Exception as E         ( throwDyn, try, Exception(..) ) #else > import System.IO.Error (ioeGetErrorString, try) #endif@@ -49,11 +50,31 @@ Implementations --------------- +#if defined(__GLASGOW_HASKELL__) || defined(__HUGS__)+> data HUnitFailure = HUnitFailure String+>+> hunitFailureTc :: TyCon+> hunitFailureTc = mkTyCon "HUnitFailure"+> {-# NOINLINE hunitFailureTc #-}+> +> instance Typeable HUnitFailure where+>     typeOf _ = mkTyConApp hunitFailureTc []++> assertFailure msg = E.throwDyn (HUnitFailure msg)++> performTestCase action = +>     do r <- E.try action+>        case r of +>          Right () -> return Nothing+>          Left e@(E.DynException dyn) -> +>              case fromDynamic dyn of+>                Just (HUnitFailure msg) -> return $ Just (True, msg)+>                Nothing                 -> return $ Just (False, show e)+>          Left e -> return $ Just (False, show e)+#else > hunitPrefix = "HUnit:" -> hugsPrefix  = "IO Error: User error\nReason: " > nhc98Prefix = "I/O error (user-defined), call to function `userError':\n  "-> -- GHC prepends no prefix to the user-supplied string.  > assertFailure msg = ioError (userError (hunitPrefix ++ msg)) @@ -61,14 +82,10 @@ >                             case r of Right () -> return Nothing >                                       Left  e  -> return (Just (decode e)) >  where-#if defined(__GLASGOW_HASKELL__) || defined(__HUGS__)->   decode e = let s0 = show e-#else >   decode e = let s0 = ioeGetErrorString e-#endif->                  (_, s1) = dropPrefix hugsPrefix  s0->                  (_, s2) = dropPrefix nhc98Prefix s1->              in            dropPrefix hunitPrefix s2+>                  (_, s1) = dropPrefix nhc98Prefix s0+>              in            dropPrefix hunitPrefix s1 >   dropPrefix pref str = if pref `isPrefixOf` str >                           then (True, drop (length pref) str) >                           else (False, str)+#endif
Test/HUnit/Terminal.lhs view
@@ -13,7 +13,7 @@ terminal that overwrites character positions following carriage returns and backspaces. -The helper function `ta` takes an accumlating `ShowS`-style function+The helper function `ta` takes an accumulating `ShowS`-style function that holds "committed" lines of text, a (reversed) list of characters on the current line *before* the cursor, a (normal) list of characters on the current line *after* the cursor, and the remaining input.