hspec-core 2.2.2 → 2.2.3
raw patch · 6 files changed
+12/−22 lines, 6 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- hspec-core.cabal +1/−1
- src/Test/Hspec/Core/Example.hs +3/−3
- test/Test/Hspec/Core/ExampleSpec.hs +2/−1
- test/Test/Hspec/Core/FormattersSpec.hs +3/−2
- test/Test/Hspec/Core/SpecSpec.hs +1/−14
- test/Test/Hspec/FailureReportSpec.hs +2/−1
hspec-core.cabal view
@@ -3,7 +3,7 @@ -- see: https://github.com/sol/hpack name: hspec-core-version: 2.2.2+version: 2.2.3 license: MIT license-file: LICENSE copyright: (c) 2011-2015 Simon Hengel,
src/Test/Hspec/Core/Example.hs view
@@ -85,11 +85,11 @@ hunitFailureToResult :: HUnit.HUnitFailure -> Result hunitFailureToResult e = case e of #if MIN_VERSION_HUnit(1,3,0)- HUnit.HUnitFailure loc err -> Fail location err+ HUnit.HUnitFailure mLoc err -> Fail location err where- location = case loc of+ location = case mLoc of Nothing -> Nothing- Just (HUnit.Location f l c) -> Just $ Location f l c ExactLocation+ Just loc -> Just $ Location (HUnit.locationFile loc) (HUnit.locationLine loc) (HUnit.locationColumn loc) ExactLocation #else HUnit.HUnitFailure err -> Fail Nothing err #endif
test/Test/Hspec/Core/ExampleSpec.hs view
@@ -4,6 +4,7 @@ import Helper import Mock import Data.List+import qualified Control.Exception as E import qualified Test.Hspec.Core.Example as H import qualified Test.Hspec.Core.Spec as H@@ -89,7 +90,7 @@ readIORef ref `shouldReturn` 2000 it "pretty-prints exceptions" $ do- H.Fail _ r <- evaluateExample $ property (\ (x :: Int) -> (x == 0) ==> (error "foobar" :: Bool))+ H.Fail _ r <- evaluateExample $ property (\ (x :: Int) -> (x == 0) ==> (E.throw (E.ErrorCall "foobar") :: Bool)) r `shouldBe` intercalate "\n" [ #if MIN_VERSION_QuickCheck(2,7,0) "uncaught exception: ErrorCall (foobar) (after 1 test)"
test/Test/Hspec/Core/FormattersSpec.hs view
@@ -3,6 +3,7 @@ import Prelude () import Helper+import qualified Control.Exception as E import qualified Test.Hspec.Core.Spec as H import qualified Test.Hspec.Core.Runner as H@@ -146,10 +147,10 @@ it "prints the exception type for requirements that fail due to an uncaught exception" $ do r <- runSpec $ do- H.it "foobar" (undefined :: Bool)+ H.it "foobar" (E.throw (E.ErrorCall "baz") :: Bool) r `shouldContain` [ " 1) foobar"- , " uncaught exception: ErrorCall (Prelude.undefined)"+ , " uncaught exception: ErrorCall (baz)" ] it "prints all descriptions when a nested requirement fails" $ do
test/Test/Hspec/Core/SpecSpec.hs view
@@ -1,22 +1,10 @@ {-# LANGUAGE RecordWildCards #-}- {-# LANGUAGE CPP #-}-#if MIN_VERSION_base(4,8,1)-#define HAS_SOURCE_LOCATIONS-{-# LANGUAGE ImplicitParams #-}-#endif module Test.Hspec.Core.SpecSpec (main, spec) where import Prelude () import Helper -#ifdef HAS_SOURCE_LOCATIONS-#if !MIN_VERSION_base(4,9,0)-import GHC.SrcLoc-#endif-import GHC.Stack-#endif- import Test.Hspec.Core.Spec (Item(..), Result(..)) import qualified Test.Hspec.Core.Runner as H import Test.Hspec.Core.Spec (Tree(..), runSpecM)@@ -56,8 +44,7 @@ #ifdef HAS_SOURCE_LOCATIONS it "adds source locations" $ do [Leaf item] <- runSpecM (H.it "foo" True)- let [(_, loc)] = (getCallStack ?loc)- location = H.Location (srcLocFile loc) (pred $ srcLocStartLine loc) 32 H.ExactLocation+ let location = H.Location __FILE__ (pred $ __LINE__) 32 H.ExactLocation itemLocation item `shouldBe` Just location #endif
test/Test/Hspec/FailureReportSpec.hs view
@@ -3,6 +3,7 @@ import Helper import System.IO+import qualified Control.Exception as E import Test.Hspec.FailureReport main :: IO ()@@ -12,5 +13,5 @@ spec = do describe "writeFailureReport" $ do it "prints a warning on unexpected exceptions" $ do- r <- hCapture_ [stderr] $ writeFailureReport (error "some error")+ r <- hCapture_ [stderr] $ writeFailureReport (E.throw (E.ErrorCall "some error")) r `shouldBe` "WARNING: Could not write environment variable HSPEC_FAILURES (some error)\n"