hspec-core 2.11.8 → 2.11.9
raw patch · 8 files changed
+15/−91 lines, 8 filesdep ~basedep ~hspec-metaPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: base, hspec-meta
API changes (from Hackage documentation)
Files
- hspec-core.cabal +4/−4
- src/Test/Hspec/Core/Compat.hs +1/−73
- src/Test/Hspec/Core/Example.hs +2/−2
- src/Test/Hspec/Core/Example/Location.hs +0/−4
- src/Test/Hspec/Core/Tree.hs +1/−1
- test/Test/Hspec/Core/Example/LocationSpec.hs +1/−5
- test/Test/Hspec/Core/RunnerSpec.hs +5/−1
- version.yaml +1/−1
hspec-core.cabal view
@@ -5,7 +5,7 @@ -- see: https://github.com/sol/hpack name: hspec-core-version: 2.11.8+version: 2.11.9 license: MIT license-file: LICENSE copyright: (c) 2011-2024 Simon Hengel,@@ -39,7 +39,7 @@ , QuickCheck >=2.13.1 && <2.16 , ansi-terminal >=0.6.2 , array- , base >=4.8.2.0 && <5+ , base >=4.9.0.0 && <5 , call-stack >=0.2.0 , deepseq , directory@@ -122,7 +122,7 @@ , QuickCheck >=2.14 , ansi-terminal >=0.6.2 , array- , base >=4.8.2.0 && <5+ , base >=4.9.0.0 && <5 , base-orphans , call-stack >=0.2.0 , deepseq@@ -130,7 +130,7 @@ , filepath , haskell-lexer , hspec-expectations ==0.8.4.*- , hspec-meta ==2.11.8+ , hspec-meta ==2.11.9 , process , quickcheck-io >=0.2.0 , random
src/Test/Hspec/Core/Compat.hs view
@@ -18,7 +18,7 @@ ) import Data.Maybe as Imports import Data.Foldable as Imports-import Data.CallStack as Imports (HasCallStack)+import GHC.Stack as Imports (HasCallStack, withFrozenCallStack) import System.IO import System.Exit@@ -74,76 +74,14 @@ import Data.Char #endif -#if MIN_VERSION_base(4,6,0) import Text.Read as Imports (readMaybe) import System.Environment as Imports (lookupEnv)-#else-import Text.Read-import qualified Text.ParserCombinators.ReadP as P-#endif -#if !MIN_VERSION_base(4,8,0)-import Data.Ord (comparing)-#endif -#if MIN_VERSION_base(4,7,0) import Data.Bool as Imports (bool)-#endif import Control.Concurrent -#if !MIN_VERSION_base(4,9,0)-import GHC.IO-#endif--#if !MIN_VERSION_base(4,6,0)-forkFinally :: IO a -> (Either SomeException a -> IO ()) -> IO ThreadId-forkFinally action and_then =- mask $ \restore ->- forkIO $ try (restore action) >>= and_then---- |Strict version of 'modifyIORef'-modifyIORef' :: IORef a -> (a -> a) -> IO ()-modifyIORef' ref f = do- x <- readIORef ref- let x' = f x- x' `seq` writeIORef ref x'--atomicWriteIORef :: IORef a -> a -> IO ()-atomicWriteIORef ref a = do- x <- atomicModifyIORef ref (\_ -> (a, ()))- x `seq` pass---- | Parse a string using the 'Read' instance.--- Succeeds if there is exactly one valid result.--- A 'Left' value indicates a parse error.-readEither :: Read a => String -> Either String a-readEither s =- case [ x | (x,"") <- readPrec_to_S read' minPrec s ] of- [x] -> Right x- [] -> Left "Prelude.read: no parse"- _ -> Left "Prelude.read: ambiguous parse"- where- read' =- do x <- readPrec- lift P.skipSpaces- return x---- | Parse a string using the 'Read' instance.--- Succeeds if there is exactly one valid result.-readMaybe :: Read a => String -> Maybe a-readMaybe s = case readEither s of- Left _ -> Nothing- Right a -> Just a---- | Return the value of the environment variable @var@, or @Nothing@ if--- there is no such value.------ For POSIX users, this is equivalent to 'System.Posix.Env.getEnv'.-lookupEnv :: String -> IO (Maybe String)-lookupEnv k = lookup k `fmap` getEnvironment-#endif- showType :: Typeable a => a -> String showType a = let t = typeRepTyCon (typeOf a) in show t@@ -154,16 +92,6 @@ getDefaultConcurrentJobs :: IO Int getDefaultConcurrentJobs = getNumCapabilities--#if !MIN_VERSION_base(4,9,0)-interruptible :: IO a -> IO a-interruptible act = do- st <- getMaskingState- case st of- Unmasked -> act- MaskedInterruptible -> unsafeUnmask act- MaskedUninterruptible -> act-#endif guarded :: Alternative m => (a -> Bool) -> a -> m a guarded p a = if p a then pure a else empty
src/Test/Hspec/Core/Example.hs view
@@ -103,7 +103,7 @@ Failure _ m -> m `deepseq` r safeEvaluateExample :: Example e => e -> Params -> (ActionWith (Arg e) -> IO ()) -> ProgressCallback -> IO Result-safeEvaluateExample example params around progress = safeEvaluate $ evaluateExample example params around progress+safeEvaluateExample example params around = safeEvaluate . evaluateExample example params around safeEvaluate :: IO Result -> IO Result safeEvaluate action = do@@ -180,4 +180,4 @@ instance Example (a -> Expectation) where type Arg (a -> Expectation) = a- evaluateExample e _ hook _ = hook e >> return (Result "" Success)+ evaluateExample e _params hook _ = hook e >> return (Result "" Success)
src/Test/Hspec/Core/Example/Location.hs view
@@ -54,12 +54,8 @@ locationFromErrorCall :: SomeException -> Maybe Location locationFromErrorCall e = case fromException e of-#if MIN_VERSION_base(4,9,0) Just (ErrorCallWithLocation err loc) -> parseCallStack loc <|>-#else- Just (ErrorCall err) ->-#endif fromPatternMatchFailureInDoExpression err Nothing -> Nothing
src/Test/Hspec/Core/Tree.hs view
@@ -111,7 +111,7 @@ -- parallel with other spec items , itemIsParallelizable :: Maybe Bool - -- | A flag that indicates whether this spec item is focused.+ -- | A flag that indicates whether this spec item is focused , itemIsFocused :: Bool -- | Example for behavior
test/Test/Hspec/Core/Example/LocationSpec.hs view
@@ -57,11 +57,7 @@ it "extracts Location" $ do let location =-#if MIN_VERSION_base(4,9,0)- Just $ Location file (__LINE__ + 4) 34-#else- Nothing-#endif+ Just $ Location file (succ __LINE__) 34 Left e <- try (evaluate (undefined :: ())) extractLocation e `shouldBe` location
test/Test/Hspec/Core/RunnerSpec.hs view
@@ -566,7 +566,7 @@ ] context "when formatting exceptions" $ do- let spec_ = H.it "foo" $ void (throwIO MyException)+ let spec_ = H.it "foo" $ void (withFrozenCallStack throwIO MyException) context "with --show-exceptions" $ do it "uses `show`" $ do hspecCapture ["--seed=0", "--format=failed-examples", "--display-exceptions", "--show-exceptions"] spec_@@ -596,6 +596,10 @@ , " 1) foo" , " uncaught exception: MyException" , " my exception"+#if MIN_VERSION_base(4,20,0)+ , " HasCallStack backtrace:"+ , " "+#endif , "" , " To rerun use: --match \"/foo/\" --seed 0" , ""
version.yaml view
@@ -1,4 +1,4 @@-version: &version 2.11.8+version: &version 2.11.9 synopsis: A Testing Framework for Haskell author: Simon Hengel <sol@typeful.net> maintainer: Simon Hengel <sol@typeful.net>