Skip to content

Commit

Permalink
made test in previous commit pass by handling exception in function g…
Browse files Browse the repository at this point in the history
…iven to Property.bindGen #327
  • Loading branch information
TysonMN committed Sep 9, 2021
1 parent 0019961 commit c5fd137
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/Hedgehog/Property.fs
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,11 @@ module Property =
| Success x ->
GenTuple.mapFst (Journal.append journal) (k x))

let private handle (e : exn) =
Gen.constant (Journal.singletonMessage (string e), Failure) |> ofGen

let bind (k : 'a -> Property<'b>) (m : Property<'a>) : Property<'b> =
bindGen (toGen << k) (toGen m) |> ofGen
bindGen (fun a -> (try k a with e -> handle e) |> toGen) (toGen m) |> ofGen

let private printValue (value) : string =
// sprintf "%A" is not prepared for printing ResizeArray<_> (C# List<T>) so we prepare the value instead
Expand Down

0 comments on commit c5fd137

Please sign in to comment.