[Haskell-cafe] Stack & Test Coverage

Ben Gamari ben at smart-cactus.org
Wed Sep 4 06:14:38 UTC 2019

On September 4, 2019 4:32:29 AM GMT+02:00, Hilco Wijbenga <hilco.wijbenga at gmail.com> wrote:
>Hi all,
>I have a very simple
>newtype Index = Index Int deriving (Eq, Ord, Enum)
>for which I have written tests with both HSpec and QuickCheck.
>Specifically, I have written tests for "==", "/=", "compare" (for all
>of EQ, LT, and GT), and "toEnum" & "fromEnum". So I thought I had
>_very_ thoroughly covered that one line. :-)
>Unfortunately, after running "stack clean ; stack test --coverage" I
>see in the HTML report that only Eq has been tested and that Ord and
>Enum have _no_ coverage (i.e. "never executed").
>(The module also has some regular functions and an explicit Show
>instance [all with tests] and those are apparently fine. So coverage
>does seem to work but not the way I expect?)
>What am I doing wrong?
>Haskell-Cafe mailing list
>To (un)subscribe, modify options or view archives go to:
>Only members subscribed via the mailman list are allowed to post.

This sounds like it may be a ghc bug. Can you open a ticket at https://gitlab.haskell.org/ghc/ghc?


- Ben 

More information about the Haskell-Cafe mailing list