[Haskell-cafe] Stack & Test Coverage
Hilco Wijbenga
hilco.wijbenga at gmail.com
Wed Sep 4 02:32:29 UTC 2019
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?
Cheers,
Hilco
More information about the Haskell-Cafe
mailing list