packages feed

HUnit-Plus 0.3.2 → 0.3.3

raw patch · 2 files changed

+11/−23 lines, 2 filesPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

API changes (from Hackage documentation)

- Test.HUnitPlus.Base: assertThrows :: (Exception e, Show e) => (e -> Bool) -> IO a -> Assertion
+ Test.HUnitPlus.Base: assertThrows :: (Exception e, Show e) => (e -> Assertion) -> IO a -> Assertion

Files

HUnit-Plus.cabal view
@@ -1,6 +1,6 @@ Name:                   HUnit-Plus Category:               Testing, Test-Version:                0.3.2+Version:                0.3.3 License:                BSD3 License-File:           LICENSE Author:                 Eric McCorkle@@ -24,7 +24,7 @@   Lastly, HUnit-Plus provides a wrapper which generates standalone   test-execution programs from a set of test suites.   .-  This is the third release candidate for 1.0.+  This is the fourth release candidate for 1.0 Build-type:             Simple Cabal-version:          >= 1.16 
src/Test/HUnitPlus/Base.hs view
@@ -382,20 +382,6 @@   in     assertBool msg (actual == expected) --- | Utility function for exception-checking assertions.-expectException :: Exception e-                => (e -> Bool)-                -- ^ Checks if an exception is valid.-                -> (e -> String)-                -- ^ Generates an error message.-                -> e-                -- ^ The exception.-                -> Assertion-expectException testfunc msgfunc ex =-  if testfunc ex-    then assertSuccess-    else assertFailure (msgfunc ex)- -- | Assert that the given computation throws a specific exception. assertThrowsExact :: (Exception e, Show e, Eq e)                   => e@@ -407,15 +393,20 @@   let     runComp = comp >> assertFailure ("expected exception " ++ show ex ++                                      " but computation finished normally")-    msgfunc ex' = "expected exception " ++ show ex ++ " but got " ++ show ex'-    handler = expectException (ex ==) msgfunc+    handler ex' =+      let+        msg = "expected exception " ++ show ex ++ " but got " ++ show ex'+      in+       if ex == ex'+         then assertSuccess+         else assertFailure msg   in     handle handler runComp  -- | Assert that the given computation throws an exception that -- matches a predicate. assertThrows :: (Exception e, Show e)-             => (e -> Bool)+             => (e -> Assertion)              -- ^ Exception to be caught              -> IO a              -- ^ Computation that should throw the exception@@ -426,11 +417,8 @@       do         _ <- comp         assertFailure "expected exception but computation finished normally"--    msgfunc ex = "unexpected exception " ++ show ex-    handler = expectException check msgfunc   in-    handle handler runComp+    handle check runComp  -- Overloaded `assert` Function -- ----------------------------