packages feed

hspec-contrib 0.1.0 → 0.2.0

raw patch · 3 files changed

+21/−10 lines, 3 files

Files

hspec-contrib.cabal view
@@ -1,5 +1,5 @@ name:             hspec-contrib-version:          0.1.0+version:          0.2.0 license:          MIT license-file:     LICENSE copyright:        (c) 2011-2014 Simon Hengel,
src/Test/Hspec/Contrib/HUnit.hs view
@@ -1,6 +1,9 @@+-- |+-- maintainer: Simon Hengel <sol@typeful.net> module Test.Hspec.Contrib.HUnit ( -- * Interoperability with HUnit   fromHUnitTest+, specListFromHUnitTest ) where  import           Test.Hspec.Core.Spec@@ -10,14 +13,20 @@ -- Convert a HUnit test suite to a spec.  This can be used to run existing -- HUnit tests with Hspec. fromHUnitTest :: Test -> Spec-fromHUnitTest t = case t of-  TestList xs -> mapM_ go xs-  x -> go x+fromHUnitTest = fromSpecList . specListFromHUnitTest++-- |+-- @specListFromHUnitTest@ is similar to `fromHUnitTest`, but it constructs a+-- list of `SpecTree`s instead of a `Spec`.+specListFromHUnitTest :: Test -> [SpecTree ()]+specListFromHUnitTest t = case t of+  TestList xs -> map go xs+  x -> [go x]   where-    go :: Test -> Spec+    go :: Test -> SpecTree ()     go t_ = case t_ of-      TestLabel s (TestCase e) -> it s e-      TestLabel s (TestList xs) -> describe s (mapM_ go xs)-      TestLabel s x -> describe s (go x)-      TestList xs -> describe "<unlabeled>" (mapM_ go xs)-      TestCase e -> it "<unlabeled>" e+      TestLabel s (TestCase e) -> specItem s e+      TestLabel s (TestList xs) -> specGroup s (map go xs)+      TestLabel s x -> specGroup s [go x]+      TestList xs -> specGroup "<unlabeled>" (map go xs)+      TestCase e -> specItem "<unlabeled>" e
src/Test/Hspec/Contrib/Retry.hs view
@@ -1,4 +1,6 @@ {-# LANGUAGE TypeFamilies #-}+-- |+-- maintainer: Junji Hashimoto <junji.hashimoto@gree.net> module Test.Hspec.Contrib.Retry (retryWith) where  import           Test.Hspec.Core.Spec