If you're writing a library, you need to compile the library with `-fhpc`, i.e. put it in the library stanza, not the testsuite stanza, and then you can compile the test program using your library - the resulting 'tix' file will contain the library coverage reports. You can link a HPC-built library into an executable not compiled with HPC just fine.
Normally I only compile the library under HPC mode, link it in a test, and distribute the results from that. That way your coverage reports don't include the test module (which may or may not be relevant.) I normally add a cabal flag called 'hpc' which optionally enables coverage reports for my library, e.g. flag hpc default: False library ... ... if flag(hpc) ghc-options: -fhpc Then when you want coverage reports, just say 'cabal install -fhpc --enable-tests' and the resulting properties executable will spit out the results when run. On Tue, Feb 7, 2012 at 3:16 PM, Michael Craig <mks...@gmail.com> wrote: > Thanks for the advice, all. I've got test-framework, quickcheck, and cabal's > test-suite all working together nicely. > > Cabal seems to support using hpc to check test coverage. If I add -fhpc to > the ghc-options under the test-suite, I get output like "Test coverage > report written to dist/hpc/html/tests/hpc_index.html" and "Package coverage > report written to dist/hpc/html/test-0.0.0/hpc_index.html", but those html > files are just empty tables. How does this work? > > Mike Craig > > > > > On Thu, Feb 2, 2012 at 8:45 PM, Ivan Lazar Miljenovic > <ivan.miljeno...@gmail.com> wrote: >> >> On 03/02/2012 12:22 PM, "Johan Tibell" <johan.tib...@gmail.com> wrote: >> > >> > On Thu, Feb 2, 2012 at 4:46 PM, Conrad Parker <con...@metadecks.org> >> > wrote: >> >> >> >> On 3 February 2012 08:30, Johan Tibell <johan.tib...@gmail.com> wrote: >> >> > On Thu, Feb 2, 2012 at 4:19 PM, Conrad Parker <con...@metadecks.org> >> >> > wrote: >> >> >> >> >> >> I've followed what Johan Tibbell did in the hashable package: >> >> > >> >> > >> >> > If I had known how much confusion my childhood friends would unleash >> >> > on the >> >> > Internet when they, at age 7, gave me a nickname that's spelled >> >> > slightly >> >> > differently from my last name, I would have asked them to pick >> >> > another one. >> >> > ;) >> >> >> >> lol, sorry, I actually double-checked the number of l's before writing >> >> that but didn't consider the b's. For future reference I've produced a >> >> handy chart: >> >> >> >> >> >> >> >> Letter | Real-name count | Nickname count >> >> -------+-----------------+--------------- >> >> b | 1 | 2 >> >> l | 2 | 0 >> >> -------+-----------------+--------------- >> >> SUM | 3 | 2 >> >> >> > >> > Excellent. I will tattoo it on my forehead. >> >> There is, of course, a simpler (but not necessarily easier :p) solution: >> change your name to match your nickname! >> >> > >> > >> > _______________________________________________ >> > Haskell-Cafe mailing list >> > Haskell-Cafe@haskell.org >> > http://www.haskell.org/mailman/listinfo/haskell-cafe >> > >> >> >> _______________________________________________ >> Haskell-Cafe mailing list >> Haskell-Cafe@haskell.org >> http://www.haskell.org/mailman/listinfo/haskell-cafe >> > > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe@haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > -- Regards, Austin _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe