From 701746a1b3a2773ab9a011b221ce15e2f9345d0e Mon Sep 17 00:00:00 2001 From: Calum Sieppert Date: Thu, 17 Oct 2024 09:04:20 -0600 Subject: [PATCH] Add back original seed to fscheck3 output --- Expecto.FsCheck3/FsCheck3.fs | 8 +++++--- Expecto.Tests.FsCheck3/FsCheck3Tests.fs | 2 ++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/Expecto.FsCheck3/FsCheck3.fs b/Expecto.FsCheck3/FsCheck3.fs index aa470e8..56e66d4 100644 --- a/Expecto.FsCheck3/FsCheck3.fs +++ b/Expecto.FsCheck3/FsCheck3.fs @@ -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") @@ -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 diff --git a/Expecto.Tests.FsCheck3/FsCheck3Tests.fs b/Expecto.Tests.FsCheck3/FsCheck3Tests.fs index 5c85486..5cee077 100644 --- a/Expecto.Tests.FsCheck3/FsCheck3Tests.fs +++ b/Expecto.Tests.FsCheck3/FsCheck3Tests.fs @@ -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" @@ -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."