Skip to content

Commit

Permalink
Hedgehog.Internal.Report: Support empty property names
Browse files Browse the repository at this point in the history
  • Loading branch information
sol authored and moodmosaic committed May 4, 2024
1 parent 0f342a7 commit 707e853
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions hedgehog/src/Hedgehog/Internal/Report.hs
Original file line number Diff line number Diff line change
Expand Up @@ -780,17 +780,19 @@ ppFailureReport config name tests discards seed (FailureReport _ shrinkPath mcov
ppName :: Maybe PropertyName -> Doc a
ppName = \case
Nothing ->
"<interactive>"
"<interactive>" <> WL.space
Just "" ->
mempty
Just (PropertyName name) ->
WL.text name
WL.text name <> WL.space

ppProgress :: MonadIO m => Maybe PropertyName -> Report Progress -> m (Doc Markup)
ppProgress name (Report tests discards coverage _ status) =
case status of
Running ->
pure . WL.vsep $ [
icon RunningIcon '' . WL.annotate RunningHeader $
ppName name <+>
ppName name <>
"passed" <+>
ppTestCount tests <>
ppWithDiscardCount discards <+>
Expand All @@ -800,7 +802,7 @@ ppProgress name (Report tests discards coverage _ status) =

Shrinking failure ->
pure . icon ShrinkingIcon '' . WL.annotate ShrinkingHeader $
ppName name <+>
ppName name <>
"failed" <+> ppFailedAtLocation (failureLocation failure) <#>
"after" <+>
ppTestCount tests <>
Expand All @@ -817,7 +819,7 @@ ppResultWith config name (Report tests discards coverage seed result) = do
pfailure <- ppFailureReport config name tests discards seed failure
pure . WL.vsep $ [
icon FailedIcon '' . WL.align . WL.annotate FailedText $
ppName name <+>
ppName name <>
"failed" <+> ppFailedAtLocation (failureLocation failure) <#>
"after" <+>
ppTestCount tests <>
Expand All @@ -832,7 +834,7 @@ ppResultWith config name (Report tests discards coverage seed result) = do
GaveUp ->
pure . WL.vsep $ [
icon GaveUpIcon '' . WL.annotate GaveUpText $
ppName name <+>
ppName name <>
"gave up after" <+>
ppDiscardCount discards <>
", passed" <+>
Expand All @@ -844,7 +846,7 @@ ppResultWith config name (Report tests discards coverage seed result) = do
OK ->
pure . WL.vsep $ [
icon SuccessIcon '' . WL.annotate SuccessText $
ppName name <+>
ppName name <>
"passed" <+>
ppTestCount tests <>
"."
Expand Down

0 comments on commit 707e853

Please sign in to comment.