genvalidity-hspec 0.5.0.0 → 0.6.0.0
raw patch · 8 files changed
+174/−142 lines, 8 filesdep ~doctestdep ~genvaliditydep ~genvalidity-propertyPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: doctest, genvalidity, genvalidity-property, hspec, validity
API changes (from Hackage documentation)
- Test.Validity: antireflexiveOnElem :: (a -> a -> Bool) -> a -> Bool
+ Test.Validity: antireflexiveOnElem :: () => (a -> a -> Bool) -> a -> Bool
- Test.Validity: antisymmetricOnElemsWithEquality :: (a -> a -> Bool) -> (a -> a -> Bool) -> a -> a -> Bool
+ Test.Validity: antisymmetricOnElemsWithEquality :: () => (a -> a -> Bool) -> (a -> a -> Bool) -> a -> a -> Bool
- Test.Validity: failsOnGen :: (Show a, Show b, Show (f b), CanFail f) => (a -> f b) -> Gen a -> (a -> [a]) -> Property
+ Test.Validity: failsOnGen :: (Show a, Show b, Show f b, CanFail f) => (a -> f b) -> Gen a -> (a -> [a]) -> Property
- Test.Validity: failsOnGens2 :: (Show a, Show b, Show c, Show (f c), CanFail f) => (a -> b -> f c) -> Gen a -> (a -> [a]) -> Gen b -> (b -> [b]) -> Property
+ Test.Validity: failsOnGens2 :: (Show a, Show b, Show c, Show f c, CanFail f) => (a -> b -> f c) -> Gen a -> (a -> [a]) -> Gen b -> (b -> [b]) -> Property
- Test.Validity: failsOnInvalid :: (Show a, Show b, Show (f b), GenInvalid a, CanFail f) => (a -> f b) -> Property
+ Test.Validity: failsOnInvalid :: (Show a, Show b, Show f b, GenInvalid a, CanFail f) => (a -> f b) -> Property
- Test.Validity: failsOnInvalid2 :: (Show a, Show b, Show c, Show (f c), GenInvalid a, GenInvalid b, CanFail f) => (a -> b -> f c) -> Property
+ Test.Validity: failsOnInvalid2 :: (Show a, Show b, Show c, Show f c, GenInvalid a, GenInvalid b, CanFail f) => (a -> b -> f c) -> Property
- Test.Validity: leftIdentityOnElemWithEquality :: (b -> a -> a) -> (a -> a -> Bool) -> b -> a -> Bool
+ Test.Validity: leftIdentityOnElemWithEquality :: () => (b -> a -> a) -> (a -> a -> Bool) -> b -> a -> Bool
- Test.Validity: reflexiveOnElem :: (a -> a -> Bool) -> a -> Bool
+ Test.Validity: reflexiveOnElem :: () => (a -> a -> Bool) -> a -> Bool
- Test.Validity: rightIdentityOnElemWithEquality :: (a -> b -> a) -> (a -> a -> Bool) -> b -> a -> Bool
+ Test.Validity: rightIdentityOnElemWithEquality :: () => (a -> b -> a) -> (a -> a -> Bool) -> b -> a -> Bool
- Test.Validity: succeeds :: (Show a, Show b, Show (f b), GenUnchecked a, CanFail f) => (a -> f b) -> Property
+ Test.Validity: succeeds :: (Show a, Show b, Show f b, GenUnchecked a, CanFail f) => (a -> f b) -> Property
- Test.Validity: succeeds2 :: (Show a, Show b, Show c, Show (f c), GenUnchecked a, GenUnchecked b, CanFail f) => (a -> b -> f c) -> Property
+ Test.Validity: succeeds2 :: (Show a, Show b, Show c, Show f c, GenUnchecked a, GenUnchecked b, CanFail f) => (a -> b -> f c) -> Property
- Test.Validity: succeedsOnArbitrary :: (Show a, Show b, Show (f b), Arbitrary a, CanFail f) => (a -> f b) -> Property
+ Test.Validity: succeedsOnArbitrary :: (Show a, Show b, Show f b, Arbitrary a, CanFail f) => (a -> f b) -> Property
- Test.Validity: succeedsOnArbitrary2 :: (Show a, Show b, Show c, Show (f c), Arbitrary a, Arbitrary b, CanFail f) => (a -> b -> f c) -> Property
+ Test.Validity: succeedsOnArbitrary2 :: (Show a, Show b, Show c, Show f c, Arbitrary a, Arbitrary b, CanFail f) => (a -> b -> f c) -> Property
- Test.Validity: succeedsOnGen :: (Show a, Show b, Show (f b), CanFail f) => (a -> f b) -> Gen a -> (a -> [a]) -> Property
+ Test.Validity: succeedsOnGen :: (Show a, Show b, Show f b, CanFail f) => (a -> f b) -> Gen a -> (a -> [a]) -> Property
- Test.Validity: succeedsOnGens2 :: (Show a, Show b, Show c, Show (f c), CanFail f) => (a -> b -> f c) -> Gen (a, b) -> ((a, b) -> [(a, b)]) -> Property
+ Test.Validity: succeedsOnGens2 :: (Show a, Show b, Show c, Show f c, CanFail f) => (a -> b -> f c) -> Gen (a, b) -> ((a, b) -> [(a, b)]) -> Property
- Test.Validity: succeedsOnValid :: (Show a, Show b, Show (f b), GenValid a, CanFail f) => (a -> f b) -> Property
+ Test.Validity: succeedsOnValid :: (Show a, Show b, Show f b, GenValid a, CanFail f) => (a -> f b) -> Property
- Test.Validity: succeedsOnValids2 :: (Show a, Show b, Show c, Show (f c), GenValid a, GenValid b, CanFail f) => (a -> b -> f c) -> Property
+ Test.Validity: succeedsOnValids2 :: (Show a, Show b, Show c, Show f c, GenValid a, GenValid b, CanFail f) => (a -> b -> f c) -> Property
- Test.Validity: symmetricOnElems :: (a -> a -> Bool) -> a -> a -> Bool
+ Test.Validity: symmetricOnElems :: () => (a -> a -> Bool) -> a -> a -> Bool
- Test.Validity: transitiveOnElems :: (a -> a -> Bool) -> a -> a -> a -> Bool
+ Test.Validity: transitiveOnElems :: () => (a -> a -> Bool) -> a -> a -> a -> Bool
- Test.Validity: validIfSucceeds :: (Show a, Show b, Show (f b), GenUnchecked a, Validity b, CanFail f) => (a -> f b) -> Property
+ Test.Validity: validIfSucceeds :: (Show a, Show b, Show f b, GenUnchecked a, Validity b, CanFail f) => (a -> f b) -> Property
- Test.Validity: validIfSucceeds2 :: (Show a, Show b, Show c, Show (f c), GenUnchecked a, GenUnchecked b, Validity c, CanFail f) => (a -> b -> f c) -> Property
+ Test.Validity: validIfSucceeds2 :: (Show a, Show b, Show c, Show f c, GenUnchecked a, GenUnchecked b, Validity c, CanFail f) => (a -> b -> f c) -> Property
- Test.Validity: validIfSucceeds3 :: (Show a, Show b, Show c, Show d, Show (f d), GenUnchecked a, GenUnchecked b, GenUnchecked c, Validity d, CanFail f) => (a -> b -> c -> f d) -> Property
+ Test.Validity: validIfSucceeds3 :: (Show a, Show b, Show c, Show d, Show f d, GenUnchecked a, GenUnchecked b, GenUnchecked c, Validity d, CanFail f) => (a -> b -> c -> f d) -> Property
- Test.Validity: validIfSucceedsOnArbitrary :: (Show a, Show b, Show (f b), Arbitrary a, Validity b, CanFail f) => (a -> f b) -> Property
+ Test.Validity: validIfSucceedsOnArbitrary :: (Show a, Show b, Show f b, Arbitrary a, Validity b, CanFail f) => (a -> f b) -> Property
- Test.Validity: validIfSucceedsOnArbitrary2 :: (Show a, Show b, Show c, Show (f c), Arbitrary a, Arbitrary b, Validity c, CanFail f) => (a -> b -> f c) -> Property
+ Test.Validity: validIfSucceedsOnArbitrary2 :: (Show a, Show b, Show c, Show f c, Arbitrary a, Arbitrary b, Validity c, CanFail f) => (a -> b -> f c) -> Property
- Test.Validity: validIfSucceedsOnArbitrary3 :: (Show a, Show b, Show c, Show d, Show (f d), Arbitrary a, Arbitrary b, Arbitrary c, Validity d, CanFail f) => (a -> b -> c -> f d) -> Property
+ Test.Validity: validIfSucceedsOnArbitrary3 :: (Show a, Show b, Show c, Show d, Show f d, Arbitrary a, Arbitrary b, Arbitrary c, Validity d, CanFail f) => (a -> b -> c -> f d) -> Property
- Test.Validity: validIfSucceedsOnGen :: (Show a, Show b, Show (f b), Validity b, CanFail f) => (a -> f b) -> Gen a -> (a -> [a]) -> Property
+ Test.Validity: validIfSucceedsOnGen :: (Show a, Show b, Show f b, Validity b, CanFail f) => (a -> f b) -> Gen a -> (a -> [a]) -> Property
- Test.Validity: validIfSucceedsOnGens2 :: (Show a, Show b, Show c, Show (f c), Validity c, CanFail f) => (a -> b -> f c) -> Gen (a, b) -> ((a, b) -> [(a, b)]) -> Property
+ Test.Validity: validIfSucceedsOnGens2 :: (Show a, Show b, Show c, Show f c, Validity c, CanFail f) => (a -> b -> f c) -> Gen (a, b) -> ((a, b) -> [(a, b)]) -> Property
- Test.Validity: validIfSucceedsOnGens3 :: (Show a, Show b, Show c, Show d, Show (f d), Validity d, CanFail f) => (a -> b -> c -> f d) -> Gen (a, b, c) -> ((a, b, c) -> [(a, b, c)]) -> Property
+ Test.Validity: validIfSucceedsOnGens3 :: (Show a, Show b, Show c, Show d, Show f d, Validity d, CanFail f) => (a -> b -> c -> f d) -> Gen (a, b, c) -> ((a, b, c) -> [(a, b, c)]) -> Property
- Test.Validity: validIfSucceedsOnValid :: (Show a, Show b, Show (f b), GenValid a, Validity b, CanFail f) => (a -> f b) -> Property
+ Test.Validity: validIfSucceedsOnValid :: (Show a, Show b, Show f b, GenValid a, Validity b, CanFail f) => (a -> f b) -> Property
- Test.Validity: validIfSucceedsOnValids2 :: (Show a, Show b, Show c, Show (f c), GenValid a, GenValid b, Validity c, CanFail f) => (a -> b -> f c) -> Property
+ Test.Validity: validIfSucceedsOnValids2 :: (Show a, Show b, Show c, Show f c, GenValid a, GenValid b, Validity c, CanFail f) => (a -> b -> f c) -> Property
- Test.Validity: validIfSucceedsOnValids3 :: (Show a, Show b, Show c, Show d, Show (f d), GenValid a, GenValid b, GenValid c, Validity d, CanFail f) => (a -> b -> c -> f d) -> Property
+ Test.Validity: validIfSucceedsOnValids3 :: (Show a, Show b, Show c, Show d, Show f d, GenValid a, GenValid b, GenValid c, Validity d, CanFail f) => (a -> b -> c -> f d) -> Property
Files
- doctests/DocTest.hs +4/−0
- genvalidity-hspec.cabal +98/−81
- src/Test/Validity.hs +1/−2
- src/Test/Validity/Applicative.hs +18/−12
- src/Test/Validity/Arbitrary.hs +4/−6
- src/Test/Validity/Monoid.hs +19/−23
- src/Test/Validity/Utils.hs +30/−14
- test/DocTest.hs +0/−4
+ doctests/DocTest.hs view
@@ -0,0 +1,4 @@+import Test.DocTest++main :: IO ()+main = doctest ["-isrc", "src", "-XTypeApplications"]
genvalidity-hspec.cabal view
@@ -1,88 +1,105 @@-name: genvalidity-hspec-version: 0.5.0.0-cabal-version: >=1.10-build-type: Simple-license: MIT-license-file: LICENSE-copyright: Copyright: (c) 2016 Tom Sydney Kerckhove-maintainer: syd.kerckhove@gmail.com-homepage: https://github.com/NorfairKing/validity#readme-synopsis: Standard spec's for GenValidity instances-description:- Note: There are companion packages for this library:- .- * <https://hackage.haskell.org/package/genvalidity-hspec-aeson genvalidity-hspec-aeson>- .- * <https://hackage.haskell.org/package/genvalidity-hspec-binary genvalidity-hspec-binary>- .- * <https://hackage.haskell.org/package/genvalidity-hspec-cereal genvalidity-hspec-cereal>- .- * <https://hackage.haskell.org/package/genvalidity-hspec-hashable genvalidity-hspec-hashable>-category: Testing-author: Tom Sydney Kerckhove+-- This file has been generated from package.yaml by hpack version 0.20.0.+--+-- see: https://github.com/sol/hpack+--+-- hash: 206c65d35007a70eebf9849fc7608a979a491115cc4f679fa8ed710047c491c3 +name: genvalidity-hspec+version: 0.6.0.0+synopsis: Standard spec's for GenValidity instances+description: Note: There are companion packages for this library:+ .+ * <https://hackage.haskell.org/package/genvalidity-hspec-aeson genvalidity-hspec-aeson>+ .+ * <https://hackage.haskell.org/package/genvalidity-hspec-binary genvalidity-hspec-binary>+ .+ * <https://hackage.haskell.org/package/genvalidity-hspec-cereal genvalidity-hspec-cereal>+ .+ * <https://hackage.haskell.org/package/genvalidity-hspec-hashable genvalidity-hspec-hashable>+category: Testing+homepage: https://github.com/NorfairKing/validity#readme+bug-reports: https://github.com/NorfairKing/validity/issues+author: Tom Sydney Kerckhove+maintainer: syd.kerckhove@gmail.com+copyright: Copyright: (c) 2016-2018 Tom Sydney Kerckhove+license: MIT+license-file: LICENSE+build-type: Simple+cabal-version: >= 1.10+ source-repository head- type: git- location: https://github.com/NorfairKing/validity+ type: git+ location: https://github.com/NorfairKing/validity library- exposed-modules:- Test.Validity- Test.Validity.Applicative- Test.Validity.Arbitrary- Test.Validity.Eq- Test.Validity.Functor- Test.Validity.GenRelativeValidity- Test.Validity.GenValidity- Test.Validity.Monad- Test.Validity.Monoid- Test.Validity.Ord- Test.Validity.RelativeValidity- Test.Validity.Shrinking- Test.Validity.Utils- build-depends:- base >=4.9 && <5,- QuickCheck -any,- genvalidity >=0.4 && <0.5,- genvalidity-property >=0.1 && <0.2,- hspec >=2.2 && <2.5,- hspec-core -any,- validity >=0.4 && <0.5- default-language: Haskell2010- hs-source-dirs: src+ hs-source-dirs:+ src+ build-depends:+ QuickCheck+ , base >=4.9 && <5+ , genvalidity >=0.5 && <0.6+ , genvalidity-property >=0.2 && <0.3+ , hspec+ , hspec-core+ , validity >=0.5 && <0.6+ exposed-modules:+ Test.Validity+ Test.Validity.Applicative+ Test.Validity.Arbitrary+ Test.Validity.Eq+ Test.Validity.Functor+ Test.Validity.GenRelativeValidity+ Test.Validity.GenValidity+ Test.Validity.Monad+ Test.Validity.Monoid+ Test.Validity.Ord+ Test.Validity.RelativeValidity+ Test.Validity.Shrinking+ Test.Validity.Utils+ other-modules:+ Paths_genvalidity_hspec+ default-language: Haskell2010 test-suite genvalidity-hspec-doctests- type: exitcode-stdio-1.0- main-is: DocTest.hs- build-depends:- base -any,- doctest >=0.11 && <0.12,- genvalidity-hspec -any- default-language: Haskell2010- hs-source-dirs: test- ghc-options: -threaded+ type: exitcode-stdio-1.0+ main-is: DocTest.hs+ hs-source-dirs:+ doctests+ ghc-options: -threaded+ build-depends:+ QuickCheck+ , base+ , doctest+ , genvalidity-hspec+ , hspec-core+ other-modules:+ Paths_genvalidity_hspec+ default-language: Haskell2010+ test-suite genvalidity-hspec-test- type: exitcode-stdio-1.0- main-is: Spec.hs- build-depends:- base -any,- genvalidity -any,- genvalidity-hspec -any,- hspec -any,- hspec-core -any,- QuickCheck -any- default-language: Haskell2010- hs-source-dirs: test/- other-modules:- Test.Validity.ApplicativeSpec- Test.Validity.ArbitrarySpec- Test.Validity.EqSpec- Test.Validity.FunctorSpec- Test.Validity.GenRelativeValiditySpec- Test.Validity.GenValiditySpec- Test.Validity.MonadSpec- Test.Validity.MonoidSpec- Test.Validity.OrdSpec- Test.Validity.RelativeValiditySpec- Test.Validity.ShrinkingSpec- ghc-options: -threaded -rtsopts -with-rtsopts=-N -Wall+ type: exitcode-stdio-1.0+ main-is: Spec.hs+ hs-source-dirs:+ test/+ ghc-options: -threaded -rtsopts -with-rtsopts=-N -Wall+ build-depends:+ QuickCheck+ , base+ , genvalidity+ , genvalidity-hspec+ , hspec+ , hspec-core+ other-modules:+ Test.Validity.ApplicativeSpec+ Test.Validity.ArbitrarySpec+ Test.Validity.EqSpec+ Test.Validity.FunctorSpec+ Test.Validity.GenRelativeValiditySpec+ Test.Validity.GenValiditySpec+ Test.Validity.MonadSpec+ Test.Validity.MonoidSpec+ Test.Validity.OrdSpec+ Test.Validity.RelativeValiditySpec+ Test.Validity.ShrinkingSpec+ Paths_genvalidity_hspec+ default-language: Haskell2010
src/Test/Validity.hs view
@@ -263,7 +263,6 @@ import Test.Validity.Operations import Test.Validity.Ord import Test.Validity.Property-import Test.Validity.Shrinking import Test.Validity.RelativeValidity+import Test.Validity.Shrinking import Test.Validity.Utils-
src/Test/Validity/Applicative.hs view
@@ -218,7 +218,8 @@ pure (.) <*> (u :: f (b -> c)) <*> (v :: f (a -> b)) <*> (w :: f a) :: f c) (\(Anon u) (Anon v) w -> u <*> (v <*> w) :: f c)- ((,,) <$> (Anon <$> genffb) <*> (Anon <$> genffa) <*> gen) shrinkNothing+ ((,,) <$> (Anon <$> genffb) <*> (Anon <$> genffa) <*> gen)+ shrinkNothing it (unwords [ "satisfy the homomorphism law: 'pure f <*> pure x = pure (f x)' for"@@ -229,7 +230,8 @@ equivalentOnGens2 (\(Anon f) x -> pure f <*> pure x :: f b) (\(Anon f) x -> pure $ f x :: f b)- ((,) <$> (Anon <$> genfa) <*> gena) shrinkNothing+ ((,) <$> (Anon <$> genfa) <*> gena)+ shrinkNothing it (unwords [ "satisfy the interchange law: 'u <*> pure y = pure ($ y) <*> u' for"@@ -240,7 +242,8 @@ equivalentOnGens2 (\(Anon u) y -> u <*> pure y :: f b) (\(Anon u) y -> pure ($ y) <*> u :: f b)- ((,) <$> (Anon <$> genffa) <*> gena) shrinkNothing+ ((,) <$> (Anon <$> genffa) <*> gena)+ shrinkNothing it (unwords [ "satisfy the law about the functor instance: fmap f x = pure f <*> x for"@@ -251,7 +254,8 @@ equivalentOnGens2 (\(Anon f) x -> fmap f x) (\(Anon f) x -> pure f <*> x)- ((,) <$> (Anon <$> genfa) <*> gen) shrinkNothing+ ((,) <$> (Anon <$> genfa) <*> gen)+ shrinkNothing describe (seqrTypeStr @f) $ it (unwords@@ -260,10 +264,11 @@ , "in front of" , genDescr @b genbname ]) $- equivalentOnGens2- (\u v -> u *> v)- (\u v -> pure (const id) <*> u <*> v)- ((,) <$> gen <*> genb) shrinkNothing+ equivalentOnGens2+ (\u v -> u *> v)+ (\u v -> pure (const id) <*> u <*> v)+ ((,) <$> gen <*> genb)+ shrinkNothing describe (seqlTypeStr @f) $ it (unwords@@ -272,7 +277,8 @@ , "behind" , genDescr @(f a) genname ]) $- equivalentOnGens2- (\u v -> u <* v)- (\u v -> pure const <*> u <*> v)- ((,) <$> gen <*> genb) shrinkNothing+ equivalentOnGens2+ (\u v -> u <* v)+ (\u v -> pure const <*> u <*> v)+ ((,) <$> gen <*> genb)+ shrinkNothing
src/Test/Validity/Arbitrary.hs view
@@ -27,9 +27,8 @@ -- Example usage: -- -- > arbitrarySpec @Int-arbitrarySpec- :: forall a.- (Typeable a, Show a, Validity a, Arbitrary a)+arbitrarySpec ::+ forall a. (Typeable a, Show a, Validity a, Arbitrary a) => Spec arbitrarySpec = do let name = nameOf @a@@ -40,8 +39,7 @@ -- | @arbitrary@ only generates valid data -- -- prop> arbitraryGeneratesOnlyValid @Int-arbitraryGeneratesOnlyValid- :: forall a.- (Show a, Validity a, Arbitrary a)+arbitraryGeneratesOnlyValid ::+ forall a. (Show a, Validity a, Arbitrary a) => Property arbitraryGeneratesOnlyValid = genGeneratesValid @a arbitrary shrink
src/Test/Validity/Monoid.hs view
@@ -24,23 +24,20 @@ import Test.Validity.Operations import Test.Validity.Utils -memptyTypeStr- :: forall a.- Typeable a+memptyTypeStr ::+ forall a. Typeable a => String memptyTypeStr = unwords ["mempty", "::", nameOf @a] -mappendTypeStr- :: forall a.- Typeable a+mappendTypeStr ::+ forall a. Typeable a => String mappendTypeStr = unwords ["mappend", "::", an, "->", an, "->", an] where an = nameOf @a -mconcatTypeStr- :: forall a.- Typeable a+mconcatTypeStr ::+ forall a. Typeable a => String mconcatTypeStr = unwords ["mconcat", "::", "[" ++ an ++ "]", "->", an] where@@ -51,9 +48,8 @@ -- Example usage: -- -- > monoidSpecOnValid @[Double]-monoidSpecOnValid- :: forall a.- (Show a, Eq a, Monoid a, Typeable a, GenValid a)+monoidSpecOnValid ::+ forall a. (Show a, Eq a, Monoid a, Typeable a, GenValid a) => Spec monoidSpecOnValid = monoidSpecOnGen @a genValid "valid" shrinkValid @@ -62,9 +58,8 @@ -- Example usage: -- -- > monoidSpec @[Int]-monoidSpec- :: forall a.- (Show a, Eq a, Monoid a, Typeable a, GenUnchecked a)+monoidSpec ::+ forall a. (Show a, Eq a, Monoid a, Typeable a, GenUnchecked a) => Spec monoidSpec = monoidSpecOnGen @a genUnchecked "unchecked" shrinkUnchecked @@ -73,9 +68,8 @@ -- Example usage: -- -- > monoidSpecOnArbitrary @[Int]-monoidSpecOnArbitrary- :: forall a.- (Show a, Eq a, Monoid a, Typeable a, Arbitrary a)+monoidSpecOnArbitrary ::+ forall a. (Show a, Eq a, Monoid a, Typeable a, Arbitrary a) => Spec monoidSpecOnArbitrary = monoidSpecOnGen @a arbitrary "arbitrary" shrink @@ -84,10 +78,12 @@ -- Example usage: -- -- > monoidSpecOnGen (pure "a") "singleton list of 'a'"-monoidSpecOnGen- :: forall a.- (Show a, Eq a, Monoid a, Typeable a)- => Gen a -> String -> (a -> [a])-> Spec+monoidSpecOnGen ::+ forall a. (Show a, Eq a, Monoid a, Typeable a)+ => Gen a+ -> String+ -> (a -> [a])+ -> Spec monoidSpecOnGen gen genname s = parallel $ do let name = nameOf @a@@ -95,7 +91,7 @@ mappendstr = mappendTypeStr @a mconcatstr = mconcatTypeStr @a gen3 = (,,) <$> gen <*> gen <*> gen- s3 (a,b,c) = (,,) <$> s a <*> s b <*> s c+ s3 (a, b, c) = (,,) <$> s a <*> s b <*> s c genl = genListOf gen sl = shrinkList s describe ("Monoid " ++ name) $ do
src/Test/Validity/Utils.hs view
@@ -69,24 +69,40 @@ go sp = Leaf Item- { itemRequirement = s- , itemLocation = Nothing- , itemIsParallelizable = False- , itemExample =- \_ _ _ -> do- let conf = defaultConfig {configFormatter = Just silent}- r <- hspecWithResult conf $ fromSpecList [sp]- let succesful =- summaryExamples r > 0 && summaryFailures r > 0- pure $ produceResult succesful- }+ { itemRequirement = s+ , itemLocation = Nothing+#if MIN_VERSION_hspec_core(2,5,0)+ , itemIsParallelizable = Nothing+#else+ , itemIsParallelizable = False+#endif+ , itemExample =+ \_ _ _ -> do+ let conf =+ defaultConfig {configFormatter = Just silent}+ r <- hspecWithResult conf $ fromSpecList [sp]+ let succesful =+ summaryExamples r > 0 && summaryFailures r > 0+ pure $ produceResult succesful+ } #if MIN_VERSION_hspec_core(2,4,0)+#if MIN_VERSION_hspec_core(2,5,0)+produceResult :: Bool -> Test.Hspec.Core.Spec.Result+produceResult succesful = Result+ { resultInfo = ""+ , resultStatus =+ if succesful+ then Success+ else Failure Nothing $ Reason "Should have failed but didn't."+ }+#else produceResult :: Bool -> Either a Test.Hspec.Core.Spec.Result produceResult succesful = Right $ if succesful then Success else Failure Nothing $ Reason "Should have failed but didn't."+#endif #else produceResult :: Bool -> Test.Hspec.Core.Spec.Result produceResult succesful =@@ -98,9 +114,9 @@ shouldFail = mapResult $ \res -> res- { reason = unwords ["Should have failed:", reason res]- , expect = not $ expect res- }+ { reason = unwords ["Should have failed:", reason res]+ , expect = not $ expect res+ } shouldBeValid :: (Show a, Validity a) => a -> Expectation shouldBeValid a = do
− test/DocTest.hs
@@ -1,4 +0,0 @@-import Test.DocTest--main :: IO ()-main = doctest ["-isrc", "src", "-XTypeApplications"]