hedgehog 1.0 → 1.0.1
raw patch · 6 files changed
+69/−18 lines, 6 filesdep ~ansi-terminaldep ~template-haskellnew-uploaderPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependency ranges changed: ansi-terminal, template-haskell
API changes (from Hackage documentation)
+ Hedgehog: data LabelName
+ Hedgehog.Internal.Property: instance GHC.Base.Monoid Hedgehog.Internal.Property.LabelName
+ Hedgehog.Internal.Property: instance GHC.Base.Semigroup Hedgehog.Internal.Property.LabelName
- Hedgehog.Gen: unicode :: (MonadGen m, GenBase m ~ Identity) => m Char
+ Hedgehog.Gen: unicode :: MonadGen m => m Char
- Hedgehog.Internal.Gen: unicode :: (MonadGen m, GenBase m ~ Identity) => m Char
+ Hedgehog.Internal.Gen: unicode :: MonadGen m => m Char
Files
- CHANGELOG.md +27/−1
- hedgehog.cabal +5/−5
- src/Hedgehog.hs +2/−1
- src/Hedgehog/Internal/Gen.hs +15/−3
- src/Hedgehog/Internal/Property.hs +4/−4
- src/Hedgehog/Internal/Report.hs +16/−4
CHANGELOG.md view
@@ -1,3 +1,9 @@+## Version 1.0.1 (2019-09-16)+- Add compatibility with GHC 8.8 ([#319][319], [@erikd][erikd])+- Include location of failed assertion in report. This enables editors to more easily parse the location of failed test assertions, and provide links/jump functionality ([#308][308], [@owickstrom][owickstrom])+- Stop using filter to define unicode ([#303][303], [@ajmcmiddlin][ajmcmiddlin])+- Export LabelName from main module ([#299][299], [@erikd][erikd])+ ## Version 1.0 (2019-05-13) - Add histograms to labels / coverage ([#289][289], [@jacobstanley][jacobstanley]) - Improved shrinking of lists ([#276][276], [@jacobstanley][jacobstanley] / [@edsko][edsko])@@ -7,7 +13,7 @@ - `diff` function which takes any `a -> a -> Bool` comparison function ([#196][196], [@chessai][chessai] / [@jacobstanley][jacobstanley]) - Labelling of test runs via `label`, `collect` ([#262][262], [@ruhatch][ruhatch] / [@jacobstanley][jacobstanley]) - Classification of test runs via `cover`, `classify` ([#253][253], [@felixmulder][felixmulder] / [@jacobstanley][jacobstanley])-- Define proper `Applicative` instances for `NodeT`, `TreeT` and `GenT` ([#173][173][@sjakobi][sjakobi]+- Define proper `Applicative` instances for `NodeT`, `TreeT` and `GenT` ([#173][173][@sjakobi][sjakobi]) - `MonadFail` instance for `PropertyT` ([#267][267], [@geigerzaehler][geigerzaehler]) - `MonadResource` instance for `PropertyT` ([#268][268], [@geigerzaehler][geigerzaehler]) - Example for the `tripping` function ([#258][258], [@HuwCampbell][HuwCampbell])@@ -141,9 +147,23 @@ https://github.com/sjakobi [felixmulder]: https://github.com/felixmulder+[chessai]:+ https://github.com/chessai [edsko]: https://github.com/edsko+[ajmcmiddlin]:+ https://github.com/ajmcmiddlin+[owickstrom]:+ https://github.com/owickstrom +[319]:+ https://github.com/hedgehogqa/haskell-hedgehog/pull/319+[308]:+ https://github.com/hedgehogqa/haskell-hedgehog/pull/308+[303]:+ https://github.com/hedgehogqa/haskell-hedgehog/pull/303+[299]:+ https://github.com/hedgehogqa/haskell-hedgehog/pull/299 [289]: https://github.com/hedgehogqa/haskell-hedgehog/pull/289 [276]:@@ -152,6 +172,8 @@ https://github.com/hedgehogqa/haskell-hedgehog/pull/272 [268]: https://github.com/hedgehogqa/haskell-hedgehog/pull/268+[267]:+ https://github.com/hedgehogqa/haskell-hedgehog/pull/267 [262]: https://github.com/hedgehogqa/haskell-hedgehog/pull/262 [258]:@@ -174,10 +196,14 @@ https://github.com/hedgehogqa/haskell-hedgehog/pull/202 [198]: https://github.com/hedgehogqa/haskell-hedgehog/pull/198+[196]:+ https://github.com/hedgehogqa/haskell-hedgehog/pull/196 [185]: https://github.com/hedgehogqa/haskell-hedgehog/pull/185 [184]: https://github.com/hedgehogqa/haskell-hedgehog/pull/184+[173]:+ https://github.com/hedgehogqa/haskell-hedgehog/pull/173 [168]: https://github.com/hedgehogqa/haskell-hedgehog/pull/168 [162]:
hedgehog.cabal view
@@ -1,4 +1,4 @@-version: 1.0+version: 1.0.1 name: hedgehog@@ -62,12 +62,12 @@ , monad-control >= 1.0 && < 1.1 , mtl >= 2.1 && < 2.3 , pretty-show >= 1.6 && < 1.10- , primitive >= 0.6 && < 0.7+ , primitive >= 0.6 && < 0.8 , random >= 1.1 && < 1.2 , resourcet >= 1.1 && < 1.3- , semigroups >= 0.16 && < 0.19+ , semigroups >= 0.16 && < 0.20 , stm >= 2.4 && < 2.6- , template-haskell >= 2.10 && < 2.15+ , template-haskell >= 2.10 && < 2.16 , text >= 1.1 && < 1.3 , time >= 1.4 && < 1.10 , transformers >= 0.5 && < 0.6@@ -138,6 +138,6 @@ , mmorph >= 1.0 && < 1.2 , mtl >= 2.1 && < 2.3 , pretty-show >= 1.6 && < 1.10- , semigroups >= 0.16 && < 0.19+ , semigroups >= 0.16 && < 0.20 , text >= 1.1 && < 1.3 , transformers >= 0.3 && < 0.6
src/Hedgehog.hs view
@@ -110,6 +110,7 @@ , evalExceptT -- * Coverage+ , LabelName , classify , cover , label@@ -163,7 +164,7 @@ import Hedgehog.Internal.Property (evalEither, evalExceptT) import Hedgehog.Internal.Property (footnote, footnoteShow) import Hedgehog.Internal.Property (forAll, forAllWith)-import Hedgehog.Internal.Property (MonadTest(..))+import Hedgehog.Internal.Property (LabelName, MonadTest(..)) import Hedgehog.Internal.Property (Property, PropertyT, PropertyName) import Hedgehog.Internal.Property (Group(..), GroupName) import Hedgehog.Internal.Property (ShrinkLimit, withShrinks)
src/Hedgehog/Internal/Gen.hs view
@@ -1,5 +1,6 @@ {-# OPTIONS_HADDOCK not-home #-} {-# LANGUAGE ApplicativeDo #-}+{-# LANGUAGE CPP #-} {-# LANGUAGE DataKinds #-} {-# LANGUAGE DeriveFoldable #-} {-# LANGUAGE DeriveFunctor #-}@@ -486,8 +487,11 @@ runGenT size sk . k =<< runGenT size sm m +#if MIN_VERSION_base(4,13,0)+#else fail = Fail.fail+#endif instance Monad m => MonadFail (GenT m) where fail =@@ -1004,11 +1008,19 @@ enum '\0' '\255' -- | Generates a Unicode character, excluding noncharacters and invalid standalone surrogates:--- @'\0'..'\1114111' (excluding '\55296'..'\57343')@+-- @'\0'..'\1114111' (excluding '\55296'..'\57343', '\65534', '\65535')@ ---unicode :: (MonadGen m, GenBase m ~ Identity) => m Char+unicode :: (MonadGen m) => m Char unicode =- filter (not . isNoncharacter) $ filter (not . isSurrogate) unicodeAll+ let+ s1 =+ (55296, enum '\0' '\55295')+ s2 =+ (8190, enum '\57344' '\65533')+ s3 =+ (1048576, enum '\65536' '\1114111')+ in+ frequency [s1, s2, s3] -- | Generates a Unicode character, including noncharacters and invalid standalone surrogates: -- @'\0'..'\1114111'@
src/Hedgehog/Internal/Property.hs view
@@ -210,7 +210,7 @@ -- | The name of a property. ----- Can be constructed using `OverloadedStrings`:+-- Should be constructed using `OverloadedStrings`: -- -- @ -- "apples" :: PropertyName@@ -316,7 +316,7 @@ -- | The name of a group of properties. ----- Can be constructed using `OverloadedStrings`:+-- Should be constructed using `OverloadedStrings`: -- -- @ -- "fruit" :: GroupName@@ -407,7 +407,7 @@ -- | The name of a classifier. ----- Can be constructed using `OverloadedStrings`:+-- Should be constructed using `OverloadedStrings`: -- -- @ -- "apples" :: LabelName@@ -416,7 +416,7 @@ newtype LabelName = LabelName { unLabelName :: String- } deriving (Eq, Ord, Show, IsString)+ } deriving (Eq, Monoid, Ord, Semigroup, Show, IsString) -- | The extent to which a test is covered by a classifier. --
src/Hedgehog/Internal/Report.hs view
@@ -73,7 +73,7 @@ import System.IO (hSetEncoding, stdout, stderr, utf8) #endif -import Text.PrettyPrint.Annotated.WL (Doc, (<+>))+import Text.PrettyPrint.Annotated.WL (Doc, (<#>), (<+>)) import qualified Text.PrettyPrint.Annotated.WL as WL import Text.Printf (printf) @@ -714,7 +714,8 @@ Shrinking failure -> pure . icon ShrinkingIcon '↯' . WL.annotate ShrinkingHeader $ ppName name <+>- "failed after" <+>+ "failed" <+> ppFailedAtLocation (failureLocation failure) <#>+ "after" <+> ppTestCount tests <> ppShrinkDiscard (failureShrinks failure) discards <+> "(shrinking)"@@ -725,9 +726,10 @@ Failed failure -> do pfailure <- ppFailureReport name tests failure pure . WL.vsep $ [- icon FailedIcon '✗' . WL.annotate FailedText $+ icon FailedIcon '✗' . WL.align . WL.annotate FailedText $ ppName name <+>- "failed after" <+>+ "failed" <+> ppFailedAtLocation (failureLocation failure) <#>+ "after" <+> ppTestCount tests <> ppShrinkDiscard (failureShrinks failure) discards <> "."@@ -756,6 +758,16 @@ "." ] ++ ppCoverage tests coverage++ppFailedAtLocation :: Maybe Span -> Doc Markup+ppFailedAtLocation = \case+ Just x ->+ "at" <+>+ WL.text (spanFile x) <> ":" <>+ WL.pretty (unLineNo (spanStartLine x)) <> ":" <>+ WL.pretty (unColumnNo (spanStartColumn x))+ Nothing ->+ mempty ppCoverage :: TestCount -> Coverage CoverCount -> [Doc Markup] ppCoverage tests x =