
4 Sep
2019
4 Sep
'19
2:32 a.m.
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