tasty-hedgehog 1.3.1.0 → 1.4.0.2
raw patch · 3 files changed
Files
- changelog.md +13/−0
- src/Test/Tasty/Hedgehog.hs +21/−15
- tasty-hedgehog.cabal +5/−5
changelog.md view
@@ -1,5 +1,18 @@ # Revision history for tasty-hedgehog +## 1.4.0.2 -- 2023-08-07++* Support hedgehog 1.4++## 1.4.0.1 -- 2023-03-15++* Support base 4.18 (GHC 9.6)+* Improve suggested test replay command++## 1.4.0.0 -- 2022-10-12++* Support `hedgehog-1.2`. This is a breaking change due to `hedgehog`'s [new mechanism for skipping to a particular test and shrink result](https://github.com/hedgehogqa/haskell-hedgehog/pull/454). The `--hedgehog-replay` option now expects a `Skip` value and a `Seed`, for example: `stack test --test-arguments='--pattern "$NF ~ /badReverse involutive fails/" --hedgehog-replay "3:b2 Seed 10332913068362713902 1302058653756691475"'` ([#63](https://github.com/qfpl/tasty-hedgehog/pull/63))+ ## 1.3.1.0 -- 2022-10-03 * The instructions for reproducing test failures are now more clearly distinguished from `hedgehog`'s own instructions and include a pattern in the example to limit which tests are re-run. ([#62](https://github.com/qfpl/tasty-hedgehog/pull/62))
src/Test/Tasty/Hedgehog.hs view
@@ -73,15 +73,15 @@ mkTestTree (propName, prop) = testProperty (unPropertyName propName) prop -- | The replay token to use for replaying a previous test run-newtype HedgehogReplay = HedgehogReplay (Maybe (Size, Seed))+newtype HedgehogReplay = HedgehogReplay (Maybe (Skip, Seed)) deriving (Typeable) instance IsOption HedgehogReplay where defaultValue = HedgehogReplay Nothing parseValue v = HedgehogReplay . Just <$> replay- -- Reads a replay token in the form "{size} {seed}"- where replay = (,) <$> safeRead (unwords size) <*> safeRead (unwords seed)- (size, seed) = splitAt 2 $ words v+ -- Reads a replay token in the form "{skip} {seed}"+ where replay = (,) <$> skipDecompress (unwords skip) <*> safeRead (unwords seed)+ (skip, seed) = splitAt 1 $ words v optionName = return "hedgehog-replay" optionHelp = return "Replay token to use for replaying a previous test run" @@ -147,7 +147,10 @@ reportToProgress :: PropertyConfig -> Report Progress -> T.Progress-reportToProgress config (Report testsDone _ _ status) =+reportToProgress config Report{+ reportTests = testsDone,+ reportStatus = status+ } = let TestLimit testLimit = propertyTestLimit config ShrinkLimit shrinkLimit = propertyShrinkLimit config@@ -171,16 +174,20 @@ pure $ case reportStatus report of Failed fr -> let- size = failureSize fr- seed = failureSeed fr+ count = reportTests report+ seed = reportSeed report+ discards = reportDiscards report+ shrinkPath = failureShrinkPath fr replayStr = if showReplay then- "\nUse '--pattern \"$NF ~ /" +++ "\nUse \"--pattern \'$NF ~ /" ++ testName ++- "/\" --hedgehog-replay \"" ++- show size ++ " " ++ show seed ++- "\"' to reproduce from the command-line."+ "/\' --hedgehog-replay \'" +++ skipCompress (SkipToShrink count discards shrinkPath) +++ " " +++ show seed +++ "\'\" to reproduce from the command-line." else "" in s ++ replayStr ++ "\n"@@ -211,13 +218,12 @@ (fromMaybe (propertyShrinkLimit pConfig) mShrinks) (fromMaybe (propertyShrinkRetries pConfig) mRetries) (NoConfidenceTermination $ fromMaybe (propertyTestLimit pConfig) mTests)+ (maybe Nothing (Just . fst) replay) randSeed <- Seed.random- let- size = maybe 0 fst replay- seed = maybe randSeed snd replay+ let seed = maybe randSeed snd replay - report <- checkReport config size seed pTest (yieldProgress . reportToProgress config)+ report <- checkReport config 0 seed pTest (yieldProgress . reportToProgress config) let resultFn = if reportStatus report == OK
tasty-hedgehog.cabal view
@@ -1,5 +1,5 @@ name: tasty-hedgehog-version: 1.3.1.0+version: 1.4.0.2 license: BSD3 license-file: LICENCE author: Dave Laing@@ -21,10 +21,10 @@ library exposed-modules: Test.Tasty.Hedgehog- build-depends: base >= 4.8 && <4.18+ build-depends: base >= 4.8 && <4.19 , tagged >= 0.8 && < 0.9 , tasty >= 0.11 && < 1.5- , hedgehog >= 1.0.2 && < 1.1.3+ , hedgehog >= 1.4 && < 1.5 hs-source-dirs: src ghc-options: -Wall default-language: Haskell2010@@ -33,10 +33,10 @@ type: exitcode-stdio-1.0 main-is: Main.hs hs-source-dirs: test- build-depends: base >= 4.8 && <4.18+ build-depends: base >= 4.8 && <4.19 , tasty >= 0.11 && < 1.5 , tasty-expected-failure >= 0.11 && < 0.13- , hedgehog >= 1.0.2 && < 1.1.3+ , hedgehog >= 1.4 && < 1.5 , tasty-hedgehog ghc-options: -Wall default-language: Haskell2010