Skip to content

Commit

Permalink
Fix bug in Property.recheck where the result is always Failed hedgeho…
Browse files Browse the repository at this point in the history
  • Loading branch information
TysonMN committed Jul 23, 2022
1 parent cec4a39 commit 5a97699
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## Version TBD

- Fix bug in `Property.recheck` where the result is always `Failed`. ([#415][415], [@TysonMN][TysonMN])

## Version 0.12.1 (2021-12-31)

- Add `Tree.apply`. Change `Gen.apply` from monadic to applicative. Revert runtime optimization of `Gen.integral`. ([#398][398], [@TysonMN][TysonMN])
Expand Down Expand Up @@ -192,6 +196,8 @@
[porges]:
https://github.com/porges

[415]:
https://github.com/hedgehogqa/fsharp-hedgehog/pull/415
[401]:
https://github.com/hedgehogqa/fsharp-hedgehog/pull/401
[400]:
Expand Down
14 changes: 9 additions & 5 deletions src/Hedgehog/Property.fs
Original file line number Diff line number Diff line change
Expand Up @@ -163,11 +163,15 @@ module Property =
let rec skipPassedChild children shrinkPath =
match children, shrinkPath with
| _, [] ->
Failed {
Shrinks = 0<shrinks>
Journal = root.Value |> fst
RecheckInfo = None
}
let journal, outcome = root.Value
match outcome with
| Failure ->
{ Shrinks = 0<shrinks>
Journal = journal
RecheckInfo = None }
|> Failed
| Success _ -> OK
| Discard -> failwith "Unexpected 'Discard' result when rechecking. This should never happen."
| [], _ -> failwith "The shrink path lead to a dead end. This should never happen."
| _ :: childrenTail, ShrinkOutcome.Pass :: shrinkPathTail -> skipPassedChild childrenTail shrinkPathTail
| childrenHead :: _, ShrinkOutcome.Fail :: shrinkPathTail -> followShrinkPath childrenHead shrinkPathTail
Expand Down

0 comments on commit 5a97699

Please sign in to comment.