hspec-core 2.5.1 → 2.5.2
raw patch · 7 files changed
+69/−9 lines, 7 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
- Test.Hspec.Core.Spec: context :: String -> SpecWith a -> SpecWith a
+ Test.Hspec.Core.Spec: context :: HasCallStack => String -> SpecWith a -> SpecWith a
- Test.Hspec.Core.Spec: describe :: String -> SpecWith a -> SpecWith a
+ Test.Hspec.Core.Spec: describe :: HasCallStack => String -> SpecWith a -> SpecWith a
- Test.Hspec.Core.Spec: specGroup :: String -> [SpecTree a] -> SpecTree a
+ Test.Hspec.Core.Spec: specGroup :: HasCallStack => String -> [SpecTree a] -> SpecTree a
- Test.Hspec.Core.Spec: xcontext :: String -> SpecWith a -> SpecWith a
+ Test.Hspec.Core.Spec: xcontext :: HasCallStack => String -> SpecWith a -> SpecWith a
- Test.Hspec.Core.Spec: xdescribe :: String -> SpecWith a -> SpecWith a
+ Test.Hspec.Core.Spec: xdescribe :: HasCallStack => String -> SpecWith a -> SpecWith a
Files
- hspec-core.cabal +2/−2
- src/Test/Hspec/Core/Formatters.hs +11/−0
- src/Test/Hspec/Core/Spec.hs +4/−4
- src/Test/Hspec/Core/Tree.hs +11/−3
- test/Test/Hspec/Core/FormattersSpec.hs +9/−0
- test/Test/Hspec/Core/RunnerSpec.hs +24/−0
- test/Test/Hspec/Core/SpecSpec.hs +8/−0
hspec-core.cabal view
@@ -2,10 +2,10 @@ -- -- see: https://github.com/sol/hpack ----- hash: cd0a31bd7edaf1f1a446581fe294f3b1ece7f6ad4c2b328ed847b570055241fa+-- hash: a6145f4a8f01c6344cd3a210ae77832823ae24ae25509d889b47e91d85661e2c name: hspec-core-version: 2.5.1+version: 2.5.2 license: MIT license-file: LICENSE copyright: (c) 2011-2018 Simon Hengel,
src/Test/Hspec/Core/Formatters.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE CPP #-} -- | -- Stability: experimental --@@ -183,6 +184,16 @@ forM_ (zip [1..] failures) $ \x -> do formatFailure x writeLine ""++#if __GLASGOW_HASKELL__ == 800+ withFailColor $ do+ writeLine "WARNING:"+ writeLine " Your version of GHC is affected by https://ghc.haskell.org/trac/ghc/ticket/13285."+ writeLine " Source locations may not work as expected."+ writeLine ""+ writeLine " Please consider upgrading GHC!"+ writeLine ""+#endif write "Randomized with seed " >> usedSeed >>= writeLine . show writeLine ""
src/Test/Hspec/Core/Spec.hs view
@@ -45,22 +45,22 @@ import Test.Hspec.Core.Spec.Monad -- | The @describe@ function combines a list of specs into a larger spec.-describe :: String -> SpecWith a -> SpecWith a+describe :: HasCallStack => String -> SpecWith a -> SpecWith a describe label spec = runIO (runSpecM spec) >>= fromSpecList . return . specGroup label -- | @context@ is an alias for `describe`.-context :: String -> SpecWith a -> SpecWith a+context :: HasCallStack => String -> SpecWith a -> SpecWith a context = describe -- | -- Changing `describe` to `xdescribe` marks all spec items of the corresponding subtree as pending. -- -- This can be used to temporarily disable spec items.-xdescribe :: String -> SpecWith a -> SpecWith a+xdescribe :: HasCallStack => String -> SpecWith a -> SpecWith a xdescribe label spec = before_ pending_ $ describe label spec -- | @xcontext@ is an alias for `xdescribe`.-xcontext :: String -> SpecWith a -> SpecWith a+xcontext :: HasCallStack => String -> SpecWith a -> SpecWith a xcontext = xdescribe -- | The @it@ function creates a spec item.
src/Test/Hspec/Core/Tree.hs view
@@ -19,6 +19,7 @@ import Test.Hspec.Core.Compat import Data.CallStack+import Data.Maybe import Test.Hspec.Core.Example @@ -56,22 +57,29 @@ } -- | The @specGroup@ function combines a list of specs into a larger spec.-specGroup :: String -> [SpecTree a] -> SpecTree a+specGroup :: HasCallStack => String -> [SpecTree a] -> SpecTree a specGroup s = Node msg where+ msg :: HasCallStack => String msg- | null s = "(no description given)"+ | null s = fromMaybe "(no description given)" defaultDescription | otherwise = s -- | The @specItem@ function creates a spec item. specItem :: (HasCallStack, Example a) => String -> a -> SpecTree (Arg a) specItem s e = Leaf $ Item requirement location Nothing (safeEvaluateExample e) where+ requirement :: HasCallStack => String requirement- | null s = "(unspecified behavior)"+ | null s = fromMaybe "(unspecified behavior)" defaultDescription | otherwise = s location :: HasCallStack => Maybe Location location = case reverse callStack of (_, loc) : _ -> Just (Location (srcLocFile loc) (srcLocStartLine loc) (srcLocStartCol loc))+ _ -> Nothing++defaultDescription :: HasCallStack => Maybe String+defaultDescription = case reverse callStack of+ (_, loc) : _ -> Just (srcLocModule loc ++ ":" ++ show (srcLocStartLine loc) ++ ":" ++ show (srcLocStartCol loc)) _ -> Nothing
test/Test/Hspec/Core/FormattersSpec.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE CPP #-} {-# LANGUAGE OverloadedStrings #-} module Test.Hspec.Core.FormattersSpec (spec) where @@ -216,6 +217,14 @@ , " two" , " third" , ""+#if __GLASGOW_HASKELL__ == 800+ , "WARNING:"+ , " Your version of GHC is affected by https://ghc.haskell.org/trac/ghc/ticket/13285."+ , " Source locations may not work as expected."+ , ""+ , " Please consider upgrading GHC!"+ , ""+#endif , "Randomized with seed 0" , "" ]
test/Test/Hspec/Core/RunnerSpec.hs view
@@ -195,6 +195,14 @@ , "" , " 1) foo" , ""+#if __GLASGOW_HASKELL__ == 800+ , "WARNING:"+ , " Your version of GHC is affected by https://ghc.haskell.org/trac/ghc/ticket/13285."+ , " Source locations may not work as expected."+ , ""+ , " Please consider upgrading GHC!"+ , ""+#endif , "Randomized with seed 23" , "" ]@@ -256,6 +264,14 @@ , "" , " 1) bar" , ""+#if __GLASGOW_HASKELL__ == 800+ , "WARNING:"+ , " Your version of GHC is affected by https://ghc.haskell.org/trac/ghc/ticket/13285."+ , " Source locations may not work as expected."+ , ""+ , " Please consider upgrading GHC!"+ , ""+#endif , "Randomized with seed 23" , "" , "Finished in 0.0000 seconds"@@ -294,6 +310,14 @@ , "" , " 1) foo bar" , ""+#if __GLASGOW_HASKELL__ == 800+ , "WARNING:"+ , " Your version of GHC is affected by https://ghc.haskell.org/trac/ghc/ticket/13285."+ , " Source locations may not work as expected."+ , ""+ , " Please consider upgrading GHC!"+ , ""+#endif , "Randomized with seed 23" , "" , "Finished in 0.0000 seconds"
test/Test/Hspec/Core/SpecSpec.hs view
@@ -26,7 +26,11 @@ context "when no description is given" $ do it "uses a default description" $ do [Node d _] <- runSpecM (H.describe "" (pure ()))+#if MIN_VERSION_base(4,8,1)+ d `shouldBe` "Test.Hspec.Core.SpecSpec:" ++ show (__LINE__ - 2 :: Int) ++ ":33"+#else d `shouldBe` "(no description given)"+#endif describe "xdescribe" $ do it "creates a tree of pending spec items" $ do@@ -57,7 +61,11 @@ context "when no description is given" $ do it "uses a default description" $ do [Leaf item] <- runSpecM (H.it "" True)+#if MIN_VERSION_base(4,8,1)+ itemRequirement item `shouldBe` "Test.Hspec.Core.SpecSpec:" ++ show (__LINE__ - 2 :: Int) ++ ":34"+#else itemRequirement item `shouldBe` "(unspecified behavior)"+#endif describe "xit" $ do it "creates a pending spec item" $ do