Skip to content

Commit

Permalink
Add back original seed to fscheck3 output
Browse files Browse the repository at this point in the history
  • Loading branch information
rynoV committed Oct 17, 2024
1 parent d6e8096 commit 701746a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 5 additions & 3 deletions Expecto.FsCheck3/FsCheck3.fs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ module ExpectoFsCheck =
| TestResult.Failed (_,_,_, Outcome.Failed (:? IgnoreException as e),_,_,_) ->
raise e

| TestResult.Failed (data, original, shrunk, outcome,_originalSeed,finalSeed,size) ->
| TestResult.Failed (data, original, shrunk, outcome,originalSeed,finalSeed,size) ->
let parameters =
original
|> List.map (sprintf "%A")
Expand All @@ -70,12 +70,14 @@ module ExpectoFsCheck =
| _ -> sprintf "Labels of failing property (one or more is failing): %s\n"
(String.concat " " data.Labels)

let original =
sprintf "Original seed: (%A, %A)" originalSeed.Seed originalSeed.Gamma
let focus =
sprintf "Focus on error:\n\t%s (%A, %A, %A) \"%s\"" methodName finalSeed.Seed finalSeed.Gamma size name

sprintf "Failed after %s. %s%s\nResult:\n\t%A\n%s%s%s"
sprintf "Failed after %s. %s%s\nResult:\n\t%A\n%s%s%s\n%s"
(numTests data.NumberOfTests) parameters shrunk
outcome labels (stampsToString data.Stamps) focus
outcome labels (stampsToString data.Stamps) original focus
|> FailedException
|> raise

Expand Down
2 changes: 2 additions & 0 deletions Expecto.Tests.FsCheck3/FsCheck3Tests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ Shrunk 9 times to:
1 0 0
Result:
Failed System.Exception: Expected true, got false.
Original seed: (1UL, 3UL)
Focus on error:
etestProperty (1UL, 3UL, 50) \"Deliberately failing test\""
Expect.equal actual expected "It should fail with the right message"
Expand Down Expand Up @@ -138,6 +139,7 @@ Shrunk 9 times to:
1 0 0
Result:
Failed System.Exception: Expected true, got false.
Original seed: (1UL, 3UL)
Focus on error:
etestPropertyWithConfig (1UL, 3UL, 50) \"Deliberately failing test\""
Expect.equal actual expected "It should fail with the right message."
Expand Down

0 comments on commit 701746a

Please sign in to comment.