hspec-core 2.2.4 → 2.3.0
raw patch · 4 files changed
+26/−42 lines, 4 filesdep +call-stackdep ~HUnitdep ~hspec-expectationsdep ~hspec-meta
Dependencies added: call-stack
Dependency ranges changed: HUnit, hspec-expectations, hspec-meta
Files
- hspec-core.cabal +8/−6
- src/Test/Hspec/Core/Example.hs +9/−0
- src/Test/Hspec/Core/Spec.hs +4/−14
- src/Test/Hspec/Core/Tree.hs +5/−22
hspec-core.cabal view
@@ -1,9 +1,9 @@--- This file has been generated from package.yaml by hpack version 0.14.1.+-- This file has been generated from package.yaml by hpack version 0.15.0. -- -- see: https://github.com/sol/hpack name: hspec-core-version: 2.2.4+version: 2.3.0 license: MIT license-file: LICENSE copyright: (c) 2011-2015 Simon Hengel,@@ -40,8 +40,9 @@ , HUnit >= 1.2.5 , QuickCheck >= 2.5.1 , quickcheck-io- , hspec-expectations == 0.7.2.*+ , hspec-expectations == 0.8.0.* , async >= 2+ , call-stack exposed-modules: Test.Hspec.Core.Spec Test.Hspec.Core.Hooks@@ -69,7 +70,7 @@ main-is: Spec.hs hs-source-dirs: test- , src+ src ghc-options: -Wall build-depends: base >= 4.3 && < 5@@ -83,9 +84,10 @@ , HUnit >= 1.2.5 , QuickCheck >= 2.5.1 , quickcheck-io- , hspec-expectations == 0.7.2.*+ , hspec-expectations == 0.8.0.* , async >= 2- , hspec-meta >= 2.2.0+ , call-stack+ , hspec-meta >= 2.3.0 , silently >= 1.2.4 , process other-modules:
src/Test/Hspec/Core/Example.hs view
@@ -14,6 +14,11 @@ import Data.Maybe (fromMaybe) import Data.List (isPrefixOf) import qualified Test.HUnit.Lang as HUnit++#if MIN_VERSION_HUnit(1,4,0)+import Data.CallStack+#endif+ import qualified Control.Exception as E import Data.Typeable (Typeable) import qualified Test.QuickCheck as QC@@ -89,7 +94,11 @@ where location = case mLoc of Nothing -> Nothing+#if MIN_VERSION_HUnit(1,4,0)+ Just loc -> Just $ Location (srcLocFile loc) (srcLocStartLine loc) (srcLocStartCol loc) ExactLocation+#else Just loc -> Just $ Location (HUnit.locationFile loc) (HUnit.locationLine loc) (HUnit.locationColumn loc) ExactLocation+#endif #else HUnit.HUnitFailure err -> Fail Nothing err #endif
src/Test/Hspec/Core/Spec.hs view
@@ -1,8 +1,5 @@-{-# LANGUAGE CPP #-}-#if MIN_VERSION_base(4,8,1)-#define HAS_SOURCE_LOCATIONS-{-# LANGUAGE ImplicitParams #-}-#endif+{-# LANGUAGE FlexibleContexts #-}+{-# LANGUAGE ConstraintKinds #-} -- | -- Stability: unstable --@@ -27,11 +24,8 @@ , module Test.Hspec.Core.Tree ) where -#ifdef HAS_SOURCE_LOCATIONS-import GHC.Stack-#endif- import qualified Control.Exception as E+import Data.CallStack import Test.Hspec.Expectations (Expectation) @@ -54,11 +48,7 @@ -- > describe "absolute" $ do -- > it "returns a positive number when given a negative number" $ -- > absolute (-1) == 1-#ifdef HAS_SOURCE_LOCATIONS-it :: (?loc :: CallStack, Example a) => String -> a -> SpecWith (Arg a)-#else-it :: Example a => String -> a -> SpecWith (Arg a)-#endif+it :: (HasCallStack, Example a) => String -> a -> SpecWith (Arg a) it label action = fromSpecList [specItem label action] -- | `parallel` marks all spec items of the given spec to be safe for parallel
src/Test/Hspec/Core/Tree.hs view
@@ -1,10 +1,6 @@ {-# LANGUAGE DeriveFunctor #-}--{-# LANGUAGE CPP #-}-#if MIN_VERSION_base(4,8,1)-#define HAS_SOURCE_LOCATIONS-{-# LANGUAGE ImplicitParams #-}-#endif+{-# LANGUAGE FlexibleContexts #-}+{-# LANGUAGE ConstraintKinds #-} -- | -- Stability: unstable@@ -16,12 +12,7 @@ , specItem ) where -#ifdef HAS_SOURCE_LOCATIONS-#if !MIN_VERSION_base(4,9,0)-import GHC.SrcLoc-#endif-import GHC.Stack-#endif+import Data.CallStack import Prelude () import Test.Hspec.Compat@@ -88,11 +79,7 @@ | otherwise = s -- | The @specItem@ function creates a spec item.-#ifdef HAS_SOURCE_LOCATIONS-specItem :: (?loc :: CallStack, Example a) => String -> a -> SpecTree (Arg a)-#else-specItem :: Example a => String -> a -> SpecTree (Arg a)-#endif+specItem :: (HasCallStack, Example a) => String -> a -> SpecTree (Arg a) specItem s e = Leaf $ Item requirement location False (evaluateExample e) where requirement@@ -100,10 +87,6 @@ | otherwise = s location :: Maybe Location-#ifdef HAS_SOURCE_LOCATIONS- location = case reverse (getCallStack ?loc) of+ location = case reverse callStack of (_, loc) : _ -> Just (Location (srcLocFile loc) (srcLocStartLine loc) (srcLocStartCol loc) ExactLocation) _ -> Nothing-#else- location = Nothing-#endif