From f08fd54a3e4180970251687a49bfa3d68261135c Mon Sep 17 00:00:00 2001 From: Simon Hengel Date: Sat, 4 May 2024 15:36:48 +0700 Subject: [PATCH] Hedgehog.Internal.Report: Allow to omit source location --- hedgehog/src/Hedgehog/Internal/Report.hs | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/hedgehog/src/Hedgehog/Internal/Report.hs b/hedgehog/src/Hedgehog/Internal/Report.hs index 0c3456a4..54064688 100644 --- a/hedgehog/src/Hedgehog/Internal/Report.hs +++ b/hedgehog/src/Hedgehog/Internal/Report.hs @@ -820,13 +820,23 @@ ppResultWith config name (Report tests discards coverage seed result) = do pure . WL.vsep $ [ icon FailedIcon '✗' . WL.align . WL.annotate FailedText $ ppName name <> - "failed" <+> ppFailedAtLocation (failureLocation failure) <#> - "after" <+> + ( + if configPrintFailedAtLocation config then + "failed" <+> ppFailedAtLocation (failureLocation failure) <#> "after" + else + "failed after" + ) <+> ppTestCount tests <> ppShrinkDiscard (failureShrinks failure) discards <> - "." <#> - "shrink path:" <+> - ppSkip (SkipToShrink tests discards $ failureShrinkPath failure) + "." <> + ( + if configPrintReproduceMessage config then + WL.line <> + "shrink path:" <+> + ppSkip (SkipToShrink tests discards $ failureShrinkPath failure) + else + mempty + ) ] ++ ppCoverage tests coverage ++ pfailure @@ -1293,11 +1303,12 @@ renderResult = renderResultWith defaultConfig data Config = Config { configContext :: Context + , configPrintFailedAtLocation :: Bool , configPrintReproduceMessage :: Bool } defaultConfig :: Config -defaultConfig = Config FullContext True +defaultConfig = Config FullContext True True renderResultWith :: MonadIO m => Config -> UseColor -> Maybe PropertyName -> Report Result -> m String renderResultWith config color name x =