chell-hunit 0.1 → 0.1.0.1
raw patch · 3 files changed
+46/−40 lines, 3 filesdep ~chellPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: chell
API changes (from Hackage documentation)
Files
- chell-hunit.cabal +12/−6
- lib/Test/Chell/HUnit.hs +34/−0
- src/Test/Chell/HUnit.hs +0/−34
chell-hunit.cabal view
@@ -1,27 +1,33 @@ name: chell-hunit-version: 0.1-synopsis: Quiet test runner (HUnit support)+version: 0.1.0.1 license: MIT license-file: license.txt author: John Millikin <jmillikin@gmail.com>+maintainer: John Millikin <jmillikin@gmail.com> build-type: Simple cabal-version: >= 1.6 category: Testing bug-reports: mailto:jmillikin@gmail.com homepage: https://john-millikin.com/software/chell/-tested-with: GHC==6.12.1 +synopsis: HUnit support for Chell, a quiet test runner+ source-repository head type: bazaar location: https://john-millikin.com/software/chell/ +source-repository this+ type: bazaar+ location: https://john-millikin.com/software/chell/+ tag: chell-hunit_0.1.0.1+ library- ghc-options: -Wall- hs-source-dirs: src+ hs-source-dirs: lib+ ghc-options: -Wall -O2 build-depends: base >= 4 && < 5- , chell >= 0.1 && < 0.2+ , chell >= 0.1 && < 0.3 , HUnit >= 1.1 && < 1.3 , text
+ lib/Test/Chell/HUnit.hs view
@@ -0,0 +1,34 @@+module Test.Chell.HUnit+ ( hunit+ ) where++import Data.Text (Text, pack)++import qualified Test.Chell as Chell+import Test.HUnit.Lang (Assertion, performTestCase)++-- | Convert a sequence of HUnit assertions (embedded in IO) to a Chell+-- 'Chell.Suite'.+--+-- @+-- import Test.Chell+-- import Test.Chell.HUnit+-- import Test.HUnit+--+-- tests :: [Suite]+-- tests =+-- [ suite \"foo\"+-- [ hunit \"bar\" $ do+-- 1 + 2 \@?= 3+-- ]+-- ]+-- @+hunit :: Text -> Assertion -> Chell.Suite+hunit name io = Chell.test (Chell.Test name chell_io) where+ chell_io _ = do+ result <- performTestCase io+ return $ case result of+ Nothing -> Chell.TestPassed []+ Just err -> parseError err+ parseError (True, msg) = Chell.TestFailed [] [Chell.Failure Nothing (pack msg)]+ parseError (False, msg) = Chell.TestAborted [] (pack msg)
− src/Test/Chell/HUnit.hs
@@ -1,34 +0,0 @@-module Test.Chell.HUnit- ( hunit- ) where--import Data.Text (Text, pack)--import qualified Test.Chell as Chell-import Test.HUnit.Lang (Assertion, performTestCase)---- | Convert a sequence of HUnit assertions (embedded in IO) to a Chell--- 'Chell.Suite'.------ @--- import Test.Chell--- import Test.Chell.HUnit--- import Test.HUnit------ tests :: [Suite]--- tests =--- [ suite \"foo\"--- [ hunit \"bar\" $ do--- 1 + 2 \@?= 3--- ]--- ]--- @-hunit :: Text -> Assertion -> Chell.Suite-hunit name io = Chell.test (Chell.Test name chell_io) where- chell_io _ = do- result <- performTestCase io- return $ case result of- Nothing -> Chell.TestPassed []- Just err -> parseError err- parseError (True, msg) = Chell.TestFailed [] [Chell.Failure Nothing (pack msg)]- parseError (False, msg) = Chell.TestAborted [] (pack msg)