Skip to content

Commit 5a97699

Browse files
committed
Fix bug in Property.recheck where the result is always Failed #408
1 parent cec4a39 commit 5a97699

File tree

2 files changed

+15
-5
lines changed

2 files changed

+15
-5
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## Version TBD
2+
3+
- Fix bug in `Property.recheck` where the result is always `Failed`. ([#415][415], [@TysonMN][TysonMN])
4+
15
## Version 0.12.1 (2021-12-31)
26

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

199+
[415]:
200+
https://github.com/hedgehogqa/fsharp-hedgehog/pull/415
195201
[401]:
196202
https://github.com/hedgehogqa/fsharp-hedgehog/pull/401
197203
[400]:

src/Hedgehog/Property.fs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -163,11 +163,15 @@ module Property =
163163
let rec skipPassedChild children shrinkPath =
164164
match children, shrinkPath with
165165
| _, [] ->
166-
Failed {
167-
Shrinks = 0<shrinks>
168-
Journal = root.Value |> fst
169-
RecheckInfo = None
170-
}
166+
let journal, outcome = root.Value
167+
match outcome with
168+
| Failure ->
169+
{ Shrinks = 0<shrinks>
170+
Journal = journal
171+
RecheckInfo = None }
172+
|> Failed
173+
| Success _ -> OK
174+
| Discard -> failwith "Unexpected 'Discard' result when rechecking. This should never happen."
171175
| [], _ -> failwith "The shrink path lead to a dead end. This should never happen."
172176
| _ :: childrenTail, ShrinkOutcome.Pass :: shrinkPathTail -> skipPassedChild childrenTail shrinkPathTail
173177
| childrenHead :: _, ShrinkOutcome.Fail :: shrinkPathTail -> followShrinkPath childrenHead shrinkPathTail

0 commit comments

Comments
 (0)