tasty-hunit 0.9.1 → 0.9.2
raw patch · 3 files changed
+22/−4 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Test.Tasty.HUnit: testCaseInfo :: TestName -> IO String -> TestTree
Files
- CHANGELOG.md +5/−0
- Test/Tasty/HUnit.hs +16/−3
- tasty-hunit.cabal +1/−1
CHANGELOG.md view
@@ -1,6 +1,11 @@ Changes ======= +Version 0.9.2+-------------++Add `testCaseInfo` for tests that return some information upon success+ Version 0.9.1 -------------
Test/Tasty/HUnit.hs view
@@ -2,6 +2,7 @@ {-# LANGUAGE TypeFamilies, DeriveDataTypeable #-} module Test.Tasty.HUnit ( testCase+ , testCaseInfo , testCaseSteps , module Test.Tasty.HUnit.Orig ) where@@ -16,9 +17,21 @@ -- | Create a 'Test' for a HUnit 'Assertion' testCase :: TestName -> Assertion -> TestTree-testCase name = singleTest name . TestCase+testCase name = singleTest name . TestCase . (fmap (const "")) -newtype TestCase = TestCase Assertion+-- | Like 'testCase', except in case the test succeeds, the returned string+-- will be shown as the description. If the empty string is returned, it+-- will be ignored.+testCaseInfo :: TestName -> IO String -> TestTree+testCaseInfo name = singleTest name . TestCase++-- IO String is a computation that throws an exception upon failure or+-- returns an informational string otherwise. This allows us to unify the+-- implementation of 'testCase' and 'testCaseInfo'.+--+-- In case of testCase, we simply make the result string empty, which makes+-- tasty ignore it.+newtype TestCase = TestCase (IO String) deriving Typeable instance IsTest TestCase where@@ -35,7 +48,7 @@ hunitResult <- try assertion return $ case hunitResult of- Right {} -> testPassed ""+ Right info -> testPassed info Left (HUnitFailure message) -> testFailed message testOptions = return []
tasty-hunit.cabal view
@@ -2,7 +2,7 @@ -- documentation, see http://haskell.org/cabal/users-guide/ name: tasty-hunit-version: 0.9.1+version: 0.9.2 synopsis: HUnit support for the Tasty test framework. description: HUnit support for the Tasty test framework. license: MIT