hedgehogqa / haskell-hedgehog

Release with confidence, state-of-the-art property testing for Haskell.
677 stars 107 forks source link

[haskell][Feature request] Collect should visualize all outputs at the end of a run #537

Open ocramz opened 3 months ago

ocramz commented 3 months ago

Hi! I'm using collect in a Property, together with cover. The scale bar produced by cover is duplicated at each invocation of collect, producing that little artifact you can see at the end of the example.

I was wondering if it wouldn't be better to .. collect all examples somewhere like in an IORef and visualize them at the end of the run instead.

  ⚠ all examples filtered by isOK are correct + total                                90% ██████████████████·· ✗ 100%
    {True}
v4 = v0
v5 = v0
v4 = v3 - 3 + v4 - v5 - 9 + v3 + 7 + 7
v5 = v5 - v3 + v4 + v3 + 7 - v5
v4 = 9 + v4 + 14 + 9 - v4 - v4 + 10 - 0 - v4 + v5 - 6 + v3
v3 = 0
{v5 < 0}
  1% ▏···················  
moodmosaic commented 3 months ago

Hi, @ocramz! Thanks for reporting this.

The duplication you're seeing is due to how collect and cover interact. Your idea to aggregate results and display them at the end makes sense and could clean up the output.

Would you be interested in helping with a patch, or do you have any other thoughts?

ocramz commented 3 months ago

Thanks @moodmosaic for the feedback! I'll look into submitting a patch, time permitting.