diff --git a/cabal.project b/cabal.project new file mode 100644 index 0000000..bc54aa5 --- /dev/null +++ b/cabal.project @@ -0,0 +1,2 @@ +packages: ./hedgehog-classes + ./tasty-hedgehog-classes diff --git a/CHANGELOG.md b/hedgehog-classes/CHANGELOG.md similarity index 95% rename from CHANGELOG.md rename to hedgehog-classes/CHANGELOG.md index 3417d6d..aaaef36 100644 --- a/CHANGELOG.md +++ b/hedgehog-classes/CHANGELOG.md @@ -61,4 +61,4 @@ The changelog is available [on GitHub][2]. * Initially created. [1]: https://pvp.haskell.org -[2]: https://github.com/chessai/hedgehog-classes/releases +[2]: https://github.com/hedgehogqa/haskell-hedgehog-classes/releases diff --git a/LICENSE b/hedgehog-classes/LICENSE similarity index 100% rename from LICENSE rename to hedgehog-classes/LICENSE diff --git a/hedgehog-classes.cabal b/hedgehog-classes/hedgehog-classes.cabal similarity index 99% rename from hedgehog-classes.cabal rename to hedgehog-classes/hedgehog-classes.cabal index 72c35c8..c245d29 100644 --- a/hedgehog-classes.cabal +++ b/hedgehog-classes/hedgehog-classes.cabal @@ -36,7 +36,7 @@ build-type: extra-doc-files: README.md , CHANGELOG.md -tested-with: GHC == 8.6.5 +tested-with: GHC == 8.6.5, GHC == 8.8.1 source-repository head type: diff --git a/src/Hedgehog/Classes.hs b/hedgehog-classes/src/Hedgehog/Classes.hs similarity index 100% rename from src/Hedgehog/Classes.hs rename to hedgehog-classes/src/Hedgehog/Classes.hs diff --git a/src/Hedgehog/Classes/Alternative.hs b/hedgehog-classes/src/Hedgehog/Classes/Alternative.hs similarity index 100% rename from src/Hedgehog/Classes/Alternative.hs rename to hedgehog-classes/src/Hedgehog/Classes/Alternative.hs diff --git a/src/Hedgehog/Classes/Applicative.hs b/hedgehog-classes/src/Hedgehog/Classes/Applicative.hs similarity index 100% rename from src/Hedgehog/Classes/Applicative.hs rename to hedgehog-classes/src/Hedgehog/Classes/Applicative.hs diff --git a/src/Hedgehog/Classes/Arrow.hs b/hedgehog-classes/src/Hedgehog/Classes/Arrow.hs similarity index 100% rename from src/Hedgehog/Classes/Arrow.hs rename to hedgehog-classes/src/Hedgehog/Classes/Arrow.hs diff --git a/src/Hedgehog/Classes/Bifoldable.hs b/hedgehog-classes/src/Hedgehog/Classes/Bifoldable.hs similarity index 100% rename from src/Hedgehog/Classes/Bifoldable.hs rename to hedgehog-classes/src/Hedgehog/Classes/Bifoldable.hs diff --git a/src/Hedgehog/Classes/Bifunctor.hs b/hedgehog-classes/src/Hedgehog/Classes/Bifunctor.hs similarity index 100% rename from src/Hedgehog/Classes/Bifunctor.hs rename to hedgehog-classes/src/Hedgehog/Classes/Bifunctor.hs diff --git a/src/Hedgehog/Classes/Binary.hs b/hedgehog-classes/src/Hedgehog/Classes/Binary.hs similarity index 100% rename from src/Hedgehog/Classes/Binary.hs rename to hedgehog-classes/src/Hedgehog/Classes/Binary.hs diff --git a/src/Hedgehog/Classes/Bitraversable.hs b/hedgehog-classes/src/Hedgehog/Classes/Bitraversable.hs similarity index 100% rename from src/Hedgehog/Classes/Bitraversable.hs rename to hedgehog-classes/src/Hedgehog/Classes/Bitraversable.hs diff --git a/src/Hedgehog/Classes/Bits.hs b/hedgehog-classes/src/Hedgehog/Classes/Bits.hs similarity index 100% rename from src/Hedgehog/Classes/Bits.hs rename to hedgehog-classes/src/Hedgehog/Classes/Bits.hs diff --git a/src/Hedgehog/Classes/Category.hs b/hedgehog-classes/src/Hedgehog/Classes/Category.hs similarity index 100% rename from src/Hedgehog/Classes/Category.hs rename to hedgehog-classes/src/Hedgehog/Classes/Category.hs diff --git a/src/Hedgehog/Classes/Common.hs b/hedgehog-classes/src/Hedgehog/Classes/Common.hs similarity index 100% rename from src/Hedgehog/Classes/Common.hs rename to hedgehog-classes/src/Hedgehog/Classes/Common.hs diff --git a/src/Hedgehog/Classes/Common/ApTrans.hs b/hedgehog-classes/src/Hedgehog/Classes/Common/ApTrans.hs similarity index 100% rename from src/Hedgehog/Classes/Common/ApTrans.hs rename to hedgehog-classes/src/Hedgehog/Classes/Common/ApTrans.hs diff --git a/src/Hedgehog/Classes/Common/Bottom.hs b/hedgehog-classes/src/Hedgehog/Classes/Common/Bottom.hs similarity index 100% rename from src/Hedgehog/Classes/Common/Bottom.hs rename to hedgehog-classes/src/Hedgehog/Classes/Common/Bottom.hs diff --git a/src/Hedgehog/Classes/Common/Compat.hs b/hedgehog-classes/src/Hedgehog/Classes/Common/Compat.hs similarity index 100% rename from src/Hedgehog/Classes/Common/Compat.hs rename to hedgehog-classes/src/Hedgehog/Classes/Common/Compat.hs diff --git a/src/Hedgehog/Classes/Common/Equation.hs b/hedgehog-classes/src/Hedgehog/Classes/Common/Equation.hs similarity index 100% rename from src/Hedgehog/Classes/Common/Equation.hs rename to hedgehog-classes/src/Hedgehog/Classes/Common/Equation.hs diff --git a/src/Hedgehog/Classes/Common/Func.hs b/hedgehog-classes/src/Hedgehog/Classes/Common/Func.hs similarity index 100% rename from src/Hedgehog/Classes/Common/Func.hs rename to hedgehog-classes/src/Hedgehog/Classes/Common/Func.hs diff --git a/src/Hedgehog/Classes/Common/Gen.hs b/hedgehog-classes/src/Hedgehog/Classes/Common/Gen.hs similarity index 100% rename from src/Hedgehog/Classes/Common/Gen.hs rename to hedgehog-classes/src/Hedgehog/Classes/Common/Gen.hs diff --git a/src/Hedgehog/Classes/Common/IO.hs b/hedgehog-classes/src/Hedgehog/Classes/Common/IO.hs similarity index 100% rename from src/Hedgehog/Classes/Common/IO.hs rename to hedgehog-classes/src/Hedgehog/Classes/Common/IO.hs diff --git a/src/Hedgehog/Classes/Common/Laws.hs b/hedgehog-classes/src/Hedgehog/Classes/Common/Laws.hs similarity index 100% rename from src/Hedgehog/Classes/Common/Laws.hs rename to hedgehog-classes/src/Hedgehog/Classes/Common/Laws.hs diff --git a/src/Hedgehog/Classes/Common/PP.hs b/hedgehog-classes/src/Hedgehog/Classes/Common/PP.hs similarity index 100% rename from src/Hedgehog/Classes/Common/PP.hs rename to hedgehog-classes/src/Hedgehog/Classes/Common/PP.hs diff --git a/src/Hedgehog/Classes/Common/Property.hs b/hedgehog-classes/src/Hedgehog/Classes/Common/Property.hs similarity index 100% rename from src/Hedgehog/Classes/Common/Property.hs rename to hedgehog-classes/src/Hedgehog/Classes/Common/Property.hs diff --git a/src/Hedgehog/Classes/Common/Types.hs b/hedgehog-classes/src/Hedgehog/Classes/Common/Types.hs similarity index 100% rename from src/Hedgehog/Classes/Common/Types.hs rename to hedgehog-classes/src/Hedgehog/Classes/Common/Types.hs diff --git a/src/Hedgehog/Classes/Comonad.hs b/hedgehog-classes/src/Hedgehog/Classes/Comonad.hs similarity index 100% rename from src/Hedgehog/Classes/Comonad.hs rename to hedgehog-classes/src/Hedgehog/Classes/Comonad.hs diff --git a/src/Hedgehog/Classes/Contravariant.hs b/hedgehog-classes/src/Hedgehog/Classes/Contravariant.hs similarity index 100% rename from src/Hedgehog/Classes/Contravariant.hs rename to hedgehog-classes/src/Hedgehog/Classes/Contravariant.hs diff --git a/src/Hedgehog/Classes/Enum.hs b/hedgehog-classes/src/Hedgehog/Classes/Enum.hs similarity index 100% rename from src/Hedgehog/Classes/Enum.hs rename to hedgehog-classes/src/Hedgehog/Classes/Enum.hs diff --git a/src/Hedgehog/Classes/Eq.hs b/hedgehog-classes/src/Hedgehog/Classes/Eq.hs similarity index 100% rename from src/Hedgehog/Classes/Eq.hs rename to hedgehog-classes/src/Hedgehog/Classes/Eq.hs diff --git a/src/Hedgehog/Classes/Foldable.hs b/hedgehog-classes/src/Hedgehog/Classes/Foldable.hs similarity index 100% rename from src/Hedgehog/Classes/Foldable.hs rename to hedgehog-classes/src/Hedgehog/Classes/Foldable.hs diff --git a/src/Hedgehog/Classes/Functor.hs b/hedgehog-classes/src/Hedgehog/Classes/Functor.hs similarity index 100% rename from src/Hedgehog/Classes/Functor.hs rename to hedgehog-classes/src/Hedgehog/Classes/Functor.hs diff --git a/src/Hedgehog/Classes/Generic.hs b/hedgehog-classes/src/Hedgehog/Classes/Generic.hs similarity index 100% rename from src/Hedgehog/Classes/Generic.hs rename to hedgehog-classes/src/Hedgehog/Classes/Generic.hs diff --git a/src/Hedgehog/Classes/Integral.hs b/hedgehog-classes/src/Hedgehog/Classes/Integral.hs similarity index 100% rename from src/Hedgehog/Classes/Integral.hs rename to hedgehog-classes/src/Hedgehog/Classes/Integral.hs diff --git a/src/Hedgehog/Classes/Ix.hs b/hedgehog-classes/src/Hedgehog/Classes/Ix.hs similarity index 100% rename from src/Hedgehog/Classes/Ix.hs rename to hedgehog-classes/src/Hedgehog/Classes/Ix.hs diff --git a/src/Hedgehog/Classes/Json.hs b/hedgehog-classes/src/Hedgehog/Classes/Json.hs similarity index 100% rename from src/Hedgehog/Classes/Json.hs rename to hedgehog-classes/src/Hedgehog/Classes/Json.hs diff --git a/src/Hedgehog/Classes/Monad.hs b/hedgehog-classes/src/Hedgehog/Classes/Monad.hs similarity index 100% rename from src/Hedgehog/Classes/Monad.hs rename to hedgehog-classes/src/Hedgehog/Classes/Monad.hs diff --git a/src/Hedgehog/Classes/MonadFix.hs b/hedgehog-classes/src/Hedgehog/Classes/MonadFix.hs similarity index 100% rename from src/Hedgehog/Classes/MonadFix.hs rename to hedgehog-classes/src/Hedgehog/Classes/MonadFix.hs diff --git a/src/Hedgehog/Classes/MonadIO.hs b/hedgehog-classes/src/Hedgehog/Classes/MonadIO.hs similarity index 100% rename from src/Hedgehog/Classes/MonadIO.hs rename to hedgehog-classes/src/Hedgehog/Classes/MonadIO.hs diff --git a/src/Hedgehog/Classes/MonadPlus.hs b/hedgehog-classes/src/Hedgehog/Classes/MonadPlus.hs similarity index 100% rename from src/Hedgehog/Classes/MonadPlus.hs rename to hedgehog-classes/src/Hedgehog/Classes/MonadPlus.hs diff --git a/src/Hedgehog/Classes/MonadZip.hs b/hedgehog-classes/src/Hedgehog/Classes/MonadZip.hs similarity index 100% rename from src/Hedgehog/Classes/MonadZip.hs rename to hedgehog-classes/src/Hedgehog/Classes/MonadZip.hs diff --git a/src/Hedgehog/Classes/Monoid.hs b/hedgehog-classes/src/Hedgehog/Classes/Monoid.hs similarity index 100% rename from src/Hedgehog/Classes/Monoid.hs rename to hedgehog-classes/src/Hedgehog/Classes/Monoid.hs diff --git a/src/Hedgehog/Classes/Ord.hs b/hedgehog-classes/src/Hedgehog/Classes/Ord.hs similarity index 100% rename from src/Hedgehog/Classes/Ord.hs rename to hedgehog-classes/src/Hedgehog/Classes/Ord.hs diff --git a/src/Hedgehog/Classes/Prim.hs b/hedgehog-classes/src/Hedgehog/Classes/Prim.hs similarity index 100% rename from src/Hedgehog/Classes/Prim.hs rename to hedgehog-classes/src/Hedgehog/Classes/Prim.hs diff --git a/src/Hedgehog/Classes/Semigroup.hs b/hedgehog-classes/src/Hedgehog/Classes/Semigroup.hs similarity index 100% rename from src/Hedgehog/Classes/Semigroup.hs rename to hedgehog-classes/src/Hedgehog/Classes/Semigroup.hs diff --git a/src/Hedgehog/Classes/Semiring.hs b/hedgehog-classes/src/Hedgehog/Classes/Semiring.hs similarity index 100% rename from src/Hedgehog/Classes/Semiring.hs rename to hedgehog-classes/src/Hedgehog/Classes/Semiring.hs diff --git a/src/Hedgehog/Classes/Show.hs b/hedgehog-classes/src/Hedgehog/Classes/Show.hs similarity index 100% rename from src/Hedgehog/Classes/Show.hs rename to hedgehog-classes/src/Hedgehog/Classes/Show.hs diff --git a/src/Hedgehog/Classes/ShowRead.hs b/hedgehog-classes/src/Hedgehog/Classes/ShowRead.hs similarity index 100% rename from src/Hedgehog/Classes/ShowRead.hs rename to hedgehog-classes/src/Hedgehog/Classes/ShowRead.hs diff --git a/src/Hedgehog/Classes/Storable.hs b/hedgehog-classes/src/Hedgehog/Classes/Storable.hs similarity index 100% rename from src/Hedgehog/Classes/Storable.hs rename to hedgehog-classes/src/Hedgehog/Classes/Storable.hs diff --git a/src/Hedgehog/Classes/Traversable.hs b/hedgehog-classes/src/Hedgehog/Classes/Traversable.hs similarity index 100% rename from src/Hedgehog/Classes/Traversable.hs rename to hedgehog-classes/src/Hedgehog/Classes/Traversable.hs diff --git a/test/Spec.hs b/hedgehog-classes/test/Spec.hs similarity index 100% rename from test/Spec.hs rename to hedgehog-classes/test/Spec.hs diff --git a/test/Spec/Alternative.hs b/hedgehog-classes/test/Spec/Alternative.hs similarity index 100% rename from test/Spec/Alternative.hs rename to hedgehog-classes/test/Spec/Alternative.hs diff --git a/test/Spec/Applicative.hs b/hedgehog-classes/test/Spec/Applicative.hs similarity index 100% rename from test/Spec/Applicative.hs rename to hedgehog-classes/test/Spec/Applicative.hs diff --git a/test/Spec/Arrow.hs b/hedgehog-classes/test/Spec/Arrow.hs similarity index 100% rename from test/Spec/Arrow.hs rename to hedgehog-classes/test/Spec/Arrow.hs diff --git a/test/Spec/Bifoldable.hs b/hedgehog-classes/test/Spec/Bifoldable.hs similarity index 100% rename from test/Spec/Bifoldable.hs rename to hedgehog-classes/test/Spec/Bifoldable.hs diff --git a/test/Spec/Bifunctor.hs b/hedgehog-classes/test/Spec/Bifunctor.hs similarity index 100% rename from test/Spec/Bifunctor.hs rename to hedgehog-classes/test/Spec/Bifunctor.hs diff --git a/test/Spec/Binary.hs b/hedgehog-classes/test/Spec/Binary.hs similarity index 100% rename from test/Spec/Binary.hs rename to hedgehog-classes/test/Spec/Binary.hs diff --git a/test/Spec/Bitraversable.hs b/hedgehog-classes/test/Spec/Bitraversable.hs similarity index 100% rename from test/Spec/Bitraversable.hs rename to hedgehog-classes/test/Spec/Bitraversable.hs diff --git a/test/Spec/Bits.hs b/hedgehog-classes/test/Spec/Bits.hs similarity index 100% rename from test/Spec/Bits.hs rename to hedgehog-classes/test/Spec/Bits.hs diff --git a/test/Spec/Category.hs b/hedgehog-classes/test/Spec/Category.hs similarity index 100% rename from test/Spec/Category.hs rename to hedgehog-classes/test/Spec/Category.hs diff --git a/test/Spec/Comonad.hs b/hedgehog-classes/test/Spec/Comonad.hs similarity index 100% rename from test/Spec/Comonad.hs rename to hedgehog-classes/test/Spec/Comonad.hs diff --git a/test/Spec/Contravariant.hs b/hedgehog-classes/test/Spec/Contravariant.hs similarity index 100% rename from test/Spec/Contravariant.hs rename to hedgehog-classes/test/Spec/Contravariant.hs diff --git a/test/Spec/Enum.hs b/hedgehog-classes/test/Spec/Enum.hs similarity index 100% rename from test/Spec/Enum.hs rename to hedgehog-classes/test/Spec/Enum.hs diff --git a/test/Spec/Eq.hs b/hedgehog-classes/test/Spec/Eq.hs similarity index 100% rename from test/Spec/Eq.hs rename to hedgehog-classes/test/Spec/Eq.hs diff --git a/test/Spec/Foldable.hs b/hedgehog-classes/test/Spec/Foldable.hs similarity index 100% rename from test/Spec/Foldable.hs rename to hedgehog-classes/test/Spec/Foldable.hs diff --git a/test/Spec/Functor.hs b/hedgehog-classes/test/Spec/Functor.hs similarity index 100% rename from test/Spec/Functor.hs rename to hedgehog-classes/test/Spec/Functor.hs diff --git a/test/Spec/Generic.hs b/hedgehog-classes/test/Spec/Generic.hs similarity index 100% rename from test/Spec/Generic.hs rename to hedgehog-classes/test/Spec/Generic.hs diff --git a/test/Spec/Integral.hs b/hedgehog-classes/test/Spec/Integral.hs similarity index 100% rename from test/Spec/Integral.hs rename to hedgehog-classes/test/Spec/Integral.hs diff --git a/test/Spec/Ix.hs b/hedgehog-classes/test/Spec/Ix.hs similarity index 100% rename from test/Spec/Ix.hs rename to hedgehog-classes/test/Spec/Ix.hs diff --git a/test/Spec/Json.hs b/hedgehog-classes/test/Spec/Json.hs similarity index 100% rename from test/Spec/Json.hs rename to hedgehog-classes/test/Spec/Json.hs diff --git a/test/Spec/Monad.hs b/hedgehog-classes/test/Spec/Monad.hs similarity index 100% rename from test/Spec/Monad.hs rename to hedgehog-classes/test/Spec/Monad.hs diff --git a/test/Spec/Monoid.hs b/hedgehog-classes/test/Spec/Monoid.hs similarity index 100% rename from test/Spec/Monoid.hs rename to hedgehog-classes/test/Spec/Monoid.hs diff --git a/test/Spec/Ord.hs b/hedgehog-classes/test/Spec/Ord.hs similarity index 100% rename from test/Spec/Ord.hs rename to hedgehog-classes/test/Spec/Ord.hs diff --git a/test/Spec/Prim.hs b/hedgehog-classes/test/Spec/Prim.hs similarity index 100% rename from test/Spec/Prim.hs rename to hedgehog-classes/test/Spec/Prim.hs diff --git a/test/Spec/Semigroup.hs b/hedgehog-classes/test/Spec/Semigroup.hs similarity index 100% rename from test/Spec/Semigroup.hs rename to hedgehog-classes/test/Spec/Semigroup.hs diff --git a/test/Spec/Semiring.hs b/hedgehog-classes/test/Spec/Semiring.hs similarity index 100% rename from test/Spec/Semiring.hs rename to hedgehog-classes/test/Spec/Semiring.hs diff --git a/test/Spec/Show.hs b/hedgehog-classes/test/Spec/Show.hs similarity index 100% rename from test/Spec/Show.hs rename to hedgehog-classes/test/Spec/Show.hs diff --git a/test/Spec/Storable.hs b/hedgehog-classes/test/Spec/Storable.hs similarity index 100% rename from test/Spec/Storable.hs rename to hedgehog-classes/test/Spec/Storable.hs diff --git a/test/Spec/Traversable.hs b/hedgehog-classes/test/Spec/Traversable.hs similarity index 100% rename from test/Spec/Traversable.hs rename to hedgehog-classes/test/Spec/Traversable.hs diff --git a/tasty-hedgehog-classes/CHANGELOG.md b/tasty-hedgehog-classes/CHANGELOG.md new file mode 100644 index 0000000..154dee5 --- /dev/null +++ b/tasty-hedgehog-classes/CHANGELOG.md @@ -0,0 +1,11 @@ +# Changelog + +`tasty-hedgehog-classes` uses [PVP Versioning][1]. +The changelog is available [on GitHub][2]. + +0.1 +=== +* Initial version. + +[1]: https://pvp.haskell.org +[2]: https://github.com/hedgehogqa/haskell-hedgehog-classes/releases diff --git a/tasty-hedgehog-classes/LICENSE b/tasty-hedgehog-classes/LICENSE new file mode 100644 index 0000000..fdf29d0 --- /dev/null +++ b/tasty-hedgehog-classes/LICENSE @@ -0,0 +1,29 @@ +BSD 3-Clause License + +Copyright (c) 2019, chessai +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +* Neither the name of the copyright holder nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/tasty-hedgehog-classes/src/Test/Tasty/Hedgehog/Classes.hs b/tasty-hedgehog-classes/src/Test/Tasty/Hedgehog/Classes.hs new file mode 100644 index 0000000..48ed4bf --- /dev/null +++ b/tasty-hedgehog-classes/src/Test/Tasty/Hedgehog/Classes.hs @@ -0,0 +1,103 @@ +{-# language + TypeApplications + #-} + +module Test.Tasty.Hedgehog.Classes + ( testLaws + ) where + +import Data.Maybe (fromMaybe) +import Data.Proxy +import Test.Tasty +import Test.Tasty.Hedgehog +import Test.Tasty.Options +import qualified Test.Tasty.Providers as T + +import Hedgehog +import Hedgehog.Classes + +import Hedgehog.Internal.Property +import Hedgehog.Internal.Runner (checkReport) +import Hedgehog.Internal.Report +import Hedgehog.Internal.Seed as Seed + +testLaws :: Laws -> T.TestTree +testLaws (Laws tcName laws_props) = testGroup tcName (go laws_props) + where + go [] = [] + go ((lawName,prop):lps) = + T.singleTest lawName (P lawName prop) : go lps + +data P = P { _testName :: String, _property :: Property } + +instance T.IsTest P where + testOptions = pure + [ Option (Proxy @HedgehogReplay) + , Option (Proxy @HedgehogShowReplay) + , Option (Proxy @HedgehogTestLimit) + , Option (Proxy @HedgehogDiscardLimit) + , Option (Proxy @HedgehogShrinkLimit) + , Option (Proxy @HedgehogShrinkRetries) + ] + run opts (P name (Property pConfig pTest)) yieldProgress = do + let HedgehogReplay replay = lookupOption opts + let HedgehogShowReplay showReplay = lookupOption opts + let HedgehogTestLimit mTests = lookupOption opts + let HedgehogDiscardLimit mDiscards = lookupOption opts + let HedgehogShrinkLimit mShrinks = lookupOption opts + let HedgehogShrinkRetries mRetries = lookupOption opts + let config = PropertyConfig + (fromMaybe (propertyTestLimit pConfig) mTests) + (fromMaybe (propertyDiscardLimit pConfig) mDiscards) + (fromMaybe (propertyShrinkLimit pConfig) mShrinks) + (fromMaybe (propertyShrinkRetries pConfig) mRetries) + + randSeed <- Seed.random + let size = maybe 0 fst replay + let seed = maybe randSeed snd replay + + report <- checkReport config size seed pTest (yieldProgress . reportToProgress config) + + let resultFn = if reportStatus report == OK + then T.testPassed + else T.testFailed + + out <- reportOutput showReplay name report + pure $ resultFn out + +reportToProgress :: PropertyConfig -> Report Progress -> T.Progress +reportToProgress config (Report testsDone _ _ status) = + let + TestLimit testLimit = propertyTestLimit config + ShrinkLimit shrinkLimit = propertyShrinkLimit config + ratio x y = 1.0 * fromIntegral x / fromIntegral y + in + -- TODO add details for tests run / discarded / shrunk + case status of + Running -> + T.Progress "Running" (ratio testsDone testLimit) + Shrinking fr -> + T.Progress "Shrinking" (ratio (failureShrinks fr) shrinkLimit) + +reportOutput :: Bool -> String -> Report Result -> IO String +reportOutput showReplay name report = do + s <- renderResult Nothing (Just (PropertyName name)) report + case reportStatus report of + Failed fr -> do + let size = failureSize fr + let seed = failureSeed fr + let replayStr = if showReplay + then "\nUse '--hedgehog-replay \"" + ++ show size + ++ " " + ++ show seed + ++ "\"' to reproduce." + else "" + pure $ s ++ replayStr ++ "\n" + GaveUp {} -> do + let DiscardCount discards = reportDiscards report + pure $ s ++ " ⚐ gave up after " + ++ show discards + ++ " discards.\n" + OK -> do + pure $ s ++ " ✓ passed 100 tests.\n" diff --git a/tasty-hedgehog-classes/tasty-hedgehog-classes.cabal b/tasty-hedgehog-classes/tasty-hedgehog-classes.cabal new file mode 100644 index 0000000..3d6f8e8 --- /dev/null +++ b/tasty-hedgehog-classes/tasty-hedgehog-classes.cabal @@ -0,0 +1,53 @@ +cabal-version: 2.2 +name: + tasty-hedgehog-classes +version: + 0.1 +synopsis: + Hedgehog will eat your typeclass bugs +description: + This library extends `hedgehog-classes` with `tasty`. +homepage: + https://github.com/hedgehogqa/haskell-hedgehog-classes +bug-reports: + https://github.com/hedgehogqa/haskell-hedgehog-classes/issues +license: + BSD-3-Clause +license-file: + LICENSE +author: + chessai +maintainer: + chessai1996@gmail.com +copyright: + 2019 chessai +category: + Testing +build-type: + Simple +extra-doc-files: + README.md + , CHANGELOG.md +tested-with: GHC == 8.6.5, GHC == 8.8.1 + +source-repository head + type: + git + location: + https://github.com/hedgehogqa/haskell-hedgehog-classes.git + +library + hs-source-dirs: + src + exposed-modules: + Test.Tasty.Hedgehog.Classes + build-depends: + , base >= 4.12 && < 4.14 + , hedgehog >= 1 && < 1.1 + , hedgehog-classes >= 0.2 && < 0.3 + , tasty >= 1.2 && < 1.3 + , tasty-hedgehog >= 1.0 && < 1.1 + ghc-options: + -Wall + default-language: + Haskell2010