hspec 2.0.1 → 2.0.2
raw patch · 3 files changed
+29/−34 lines, 3 filesdep +HUnitdep ~QuickCheckdep ~hspec-coredep ~hspec-discover
Dependencies added: HUnit
Dependency ranges changed: QuickCheck, hspec-core, hspec-discover
Files
- example/Spec.hs +0/−16
- hspec.cabal +5/−18
- src/Test/Hspec/HUnit.hs +24/−0
− example/Spec.hs
@@ -1,16 +0,0 @@-module Main (main, spec) where--import Test.Hspec-import Test.QuickCheck--main :: IO ()-main = hspec spec--spec :: Spec-spec = do- describe "reverse" $ do- it "reverses a list" $ do- reverse [1 :: Int, 2, 3] `shouldBe` [3, 2, 1]-- it "gives the original list, if applied twice" $ property $- \xs -> (reverse . reverse) xs == (xs :: [Int])
hspec.cabal view
@@ -1,5 +1,5 @@ name: hspec-version: 2.0.1+version: 2.0.2 license: MIT license-file: LICENSE copyright: (c) 2011-2014 Simon Hengel,@@ -41,11 +41,12 @@ src build-depends: base == 4.*- , hspec-core == 2.0.1- , hspec-discover == 2.0.1+ , hspec-core == 2.0.2+ , hspec-discover == 2.0.2 , hspec-expectations == 0.6.1.* , transformers >= 0.2.2.0 , QuickCheck >= 2.5.1+ , HUnit >= 1.2.5 exposed-modules: Test.Hspec Test.Hspec.Runner@@ -53,6 +54,7 @@ Test.Hspec.QuickCheck Test.Hspec.Discover Test.Hspec.Core+ Test.Hspec.HUnit default-language: Haskell2010 test-suite spec@@ -76,19 +78,4 @@ , directory , stringbuilder , hspec-meta >= 1.12- default-language: Haskell2010--test-suite example- type:- exitcode-stdio-1.0- main-is:- Spec.hs- hs-source-dirs:- example- ghc-options:- -Wall- build-depends:- base == 4.*- , hspec- , QuickCheck default-language: Haskell2010
+ src/Test/Hspec/HUnit.hs view
@@ -0,0 +1,24 @@+module Test.Hspec.HUnit {-# DEPRECATED "use \"Test.Hspec.Contrib.HUnit\" from package @hspec-contrib@ instead" #-}+(+-- * Interoperability with HUnit+ fromHUnitTest+) where++import Test.Hspec.Core.Spec+import Test.HUnit (Test (..))++-- |+-- 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+ where+ go :: Test -> Spec+ 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