chell-hunit (empty) → 0.1
raw patch · 4 files changed
+87/−0 lines, 4 filesdep +HUnitdep +basedep +chellsetup-changed
Dependencies added: HUnit, base, chell, text
Files
- Setup.hs +2/−0
- chell-hunit.cabal +29/−0
- license.txt +22/−0
- src/Test/Chell/HUnit.hs +34/−0
+ Setup.hs view
@@ -0,0 +1,2 @@+import Distribution.Simple+main = defaultMain
+ chell-hunit.cabal view
@@ -0,0 +1,29 @@+name: chell-hunit+version: 0.1+synopsis: Quiet test runner (HUnit support)+license: MIT+license-file: license.txt+author: 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++source-repository head+ type: bazaar+ location: https://john-millikin.com/software/chell/++library+ ghc-options: -Wall+ hs-source-dirs: src++ build-depends:+ base >= 4 && < 5+ , chell >= 0.1 && < 0.2+ , HUnit >= 1.1 && < 1.3+ , text++ exposed-modules:+ Test.Chell.HUnit
+ license.txt view
@@ -0,0 +1,22 @@+Copyright (c) 2011 John Millikin++Permission is hereby granted, free of charge, to any person+obtaining a copy of this software and associated documentation+files (the "Software"), to deal in the Software without+restriction, including without limitation the rights to use,+copy, modify, merge, publish, distribute, sublicense, and/or sell+copies of the Software, and to permit persons to whom the+Software is furnished to do so, subject to the following+conditions:++The above copyright notice and this permission notice shall be+included in all copies or substantial portions of the Software.++THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR+OTHER DEALINGS IN THE SOFTWARE.
+ src/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)