hedgehog-golden 0.6.0 → 1.0.0
raw patch · 5 files changed
+17/−41 lines, 5 filesdep −transformersdep ~directorydep ~hedgehogPVP ok
version bump matches the API change (PVP)
Dependencies removed: transformers
Dependency ranges changed: directory, hedgehog
API changes (from Hackage documentation)
Files
- README.md +5/−19
- hedgehog-golden.cabal +4/−6
- src/Hedgehog/Golden/Aeson.hs +3/−3
- src/Hedgehog/Golden/Sample.hs +3/−10
- test/Main.hs +2/−3
README.md view
@@ -2,34 +2,20 @@ =============== A golden file extension to hedgehog -Hedgehog support------------------[Hedgehog](http://hackage.haskell.org/package/hedgehog-1.0) v1.x series is-supported by-[hedgehog-golden](https://hackage.haskell.org/package/hedgehog-golden-1.0.0)-v1.x series--[Hedgehog](http://hackage.haskell.org/package/hedgehog-0.6.1) v0.6.x series is-supported by-[hedgehog-golden](https://hackage.haskell.org/package/hedgehog-golden-0.6.0)-v0.6.x series- Example ------- ```haskell {-# LANGUAGE TemplateHaskell #-} -import Hedgehog-import qualified Hedgehog.Gen as Gen-import qualified Hedgehog.Golden.Aeson as Aeson+import Hedeghog+import qualified Hedeghog.Gen as Gen+import qualified Hedeghog.Golden.Aeson as Aeson -- | A golden test for characters in the hex range prop_char_golden :: Property-prop_char_golden =- Aeson.goldenProperty Gen.hexit+prop_char_golden = Aeson.goldenProperty Gen.hexit tests :: IO Bool-tests =- checkParallel $$discover+tests = checkParallel $$discover ```
hedgehog-golden.cabal view
@@ -1,7 +1,7 @@ cabal-version: 2.4 version:- 0.6.0+ 1.0.0 name: hedgehog-golden author:@@ -56,7 +56,6 @@ src exposed-modules: Hedgehog.Golden.Aeson- other-modules: Hedgehog.Golden.Types Hedgehog.Golden.Sample Hedgehog.Golden.Internal.Source@@ -67,11 +66,10 @@ , bytestring ^>=0.10.8.0 , containers ^>=0.6.0.1 , Diff ^>=0.3.4- , directory ^>=1.3.3.0+ , directory ^>=1.3.3.2 , extra ^>= 1.6.0- , hedgehog ^>= 0.6.1+ , hedgehog ^>= 1.0 , text ^>=1.2.3.1- , transformers ^>= 0.5.6.2 test-suite test import:@@ -85,5 +83,5 @@ other-modules: build-depends: , base ^>=4.12.0.0- , hedgehog ^>= 0.6.1+ , hedgehog ^>= 1.0 , hedgehog-golden
src/Hedgehog/Golden/Aeson.hs view
@@ -4,9 +4,9 @@ -- @ -- {-\# LANGUAGE TemplateHaskell \#-} ----- import Hedgehog--- import qualified Hedgehog.Gen as Gen--- import qualified Hedgehog.Golden.Aeson as Aeson+-- import Hedeghog+-- import qualified Hedeghog.Gen as Gen+-- import qualified Hedeghog.Golden.Aeson as Aeson -- -- -- | A golden test for characters in the hex range -- prop_char_golden :: Property
src/Hedgehog/Golden/Sample.hs view
@@ -4,29 +4,22 @@ import Prelude -import Data.Functor.Identity (runIdentity) import Data.Sequence (Seq) import Hedgehog import qualified Hedgehog.Internal.Gen as Gen import qualified Hedgehog.Internal.Tree as Tree import qualified Hedgehog.Range as Range-import Control.Monad.Trans.Maybe (MaybeT(..)) --- | Generate a fixed Seq of @a@ from the given generator+-- | Generate a fixed Seq of @a@ from the given gnerator genSamples :: Seed -> Gen a -> Seq a genSamples seed gen = let loop n = \case- Just tree -> tree+ Just tree -> Tree.treeValue tree Nothing -> if n < 0 then error "Too many discards - abandoned generating samples" else- loop (n - 1)- . fmap Tree.nodeValue- . runIdentity- . runMaybeT- . Tree.runTree- . Gen.runGenT 0 seed $ Gen.seq (Range.singleton 10) gen+ loop (n - 1) . Gen.evalGen 0 seed $ Gen.seq (Range.singleton 10) gen in loop (100 :: Int) Nothing
test/Main.hs view
@@ -3,12 +3,11 @@ import Prelude -import Control.Monad (unless) import Hedgehog (Property) import Hedgehog (checkParallel, discover)+import Hedgehog.Main (defaultMain) import qualified Hedgehog.Golden.Aeson as Aeson import qualified Hedgehog.Gen as Gen-import System.Exit (exitFailure) prop_hexit :: Property prop_hexit = Aeson.goldenProperty Gen.hexit@@ -20,4 +19,4 @@ tests = checkParallel $$discover main :: IO ()-main = tests >>= flip unless exitFailure+main = defaultMain [ tests ]