hspec-hedgehog 0.0.1.1 → 0.0.1.2
raw patch · 4 files changed
+30/−22 lines, 4 filesdep ~hedgehogdep ~hspecdep ~hspec-core
Dependency ranges changed: hedgehog, hspec, hspec-core
Files
- ChangeLog.md +7/−0
- hspec-hedgehog.cabal +4/−4
- src/Test/Hspec/Hedgehog.hs +17/−16
- test/Spec.hs +2/−2
ChangeLog.md view
@@ -1,5 +1,12 @@ # Changelog for hspec-hedgehog +## 0.0.1.2++- [#7](https://github.com/parsonsmatt/hspec-hedgehog/pull/7) @parsonsmatt+ - Handle error states better by returning them in the instance rather than throwing an exception.+- [#6](https://github.com/parsonsmatt/hspec-hedgehog/pull/6) @jezen+ - Bump lower bound on `hedgehog` to fix the build constraints.+ ## 0.0.1.1 - [#2](https://github.com/parsonsmatt/hspec-hedgehog/pull/2) @lehins
hspec-hedgehog.cabal view
@@ -1,6 +1,6 @@ cabal-version: 1.12 name: hspec-hedgehog-version: 0.0.1.1+version: 0.0.1.2 description: Please see the README on GitHub at <https://github.com/parsonsmatt/hspec-hedgehog#readme> synopsis: Integrate Hedgehog and Hspec! category: Testing@@ -29,7 +29,7 @@ base >= 4.7 && < 5 , hspec >= 2.4.4 && < 3 , hspec-core >= 2.4.4 && < 3- , hedgehog >= 1.0 && < 2+ , hedgehog >= 1.0.2 && < 2 , HUnit >= 1.5 && < 2 , QuickCheck >= 2.9.2 && < 3 , splitmix >= 0.0.1 && < 1@@ -43,8 +43,8 @@ test ghc-options: -threaded -rtsopts -with-rtsopts=-N build-depends:- base >=4.7 && <5+ base >= 4.7 && < 5 , hspec-hedgehog , hspec- , hedgehog+ , hedgehog >= 1.0.2 && < 2 default-language: Haskell2010
src/Test/Hspec/Hedgehog.hs view
@@ -104,6 +104,8 @@ import Hedgehog.Internal.Report as Hedge import Hedgehog.Internal.Runner (checkReport) import qualified Hedgehog.Internal.Seed as Seed+import Hedgehog.Internal.Source (ColumnNo (..), LineNo (..),+ Span (..)) import System.Random.SplitMix (unseedSMGen) import Test.Hspec import Test.Hspec.Core.Spec as Hspec@@ -196,20 +198,19 @@ Just (rng, _) -> pure (uncurry Seed (unseedSMGen (coerce rng))) hedgeResult <- checkReport propConfig size seed (propertyTest prop) cb ppresult <- renderResult color Nothing hedgeResult- writeIORef ref =<< case reportStatus hedgeResult of- Failed FailureReport{..} -> do- -- let fromSpan Span{..} =- -- Location- -- { locationFile = spanFile- -- , locationLine = coerce spanStartLine- -- , locationColumn = coerce spanStartColumn- -- }- -- pure- -- $ Result ""- -- $ Hspec.Failure (fromSpan <$> failureLocation) _h -- ppresult- assertFailure ppresult- GaveUp ->- assertFailure ppresult- OK ->- pure $ Result "" Success+ writeIORef ref $ Result "" $ case reportStatus hedgeResult of+ Failed FailureReport{..} ->+ let+ fromSpan Span{..} =+ Location+ { locationFile = spanFile+ , locationLine = coerce spanStartLine+ , locationColumn = coerce spanStartColumn+ }+ in+ Hspec.Failure (fromSpan <$> failureLocation) $ Reason ppresult+ GaveUp ->+ Failure Nothing (Reason "GaveUp")+ OK ->+ Success readIORef ref
test/Spec.hs view
@@ -1,12 +1,12 @@ import Control.Concurrent (threadDelay) import Control.Monad.IO.Class (liftIO)+import Data.IORef (atomicModifyIORef', readIORef, newIORef) import qualified Hedgehog.Gen as Gen import qualified Hedgehog.Range as Range import Test.Hspec (before, beforeAll, describe, hspec, it, shouldBe) import Test.Hspec.Hedgehog (PropertyT, diff, forAll, hedgehog, (/==), (===))-import Data.IORef-import Test.Hspec.QuickCheck (modifyMaxSuccess)+import Test.Hspec.QuickCheck (modifyMaxSuccess) main :: IO () main = hspec $ do