Open robrix opened 5 years ago
Doing something like using an internal library with the common code, depending on it in the test component, and then cabal-doctest
to handle the nitty-gritty ought to work.
If you can't get that to work, can you stick the code up somewhere, or abstract it into a gist, to see what's going on?
I’d like to define doctests with respect to some common
Arbitrary
instances & some other conveniences, but I’m not sure how best to share it between different modules. In particular, I don’t want to link my library againstQuickCheck
or otherwise include this testing code in it, and I would prefer to avoid defining this helper code in every module’s$setup
block.I’ve tried a couple of things, but haven’t had any luck thus far:
Adding a module to my doctest component & importing it in each module’s
$setup
block. (It can’t find the module when I do this.)Defining a private library component in the package, linking the doctest component against it, and importing it in each module’s
$setup
block. (It can’t find the module when I do this, and if I use-package …
as an argument todoctest
then it fails outright at the start, unable to find it.)Is there a way to add test-specific code such that it’ll be available to all of the modules, without adding it to the library itself? Either as a Haskell module or as some sort of library-wide
$setup
block?