I'm developing a library in Haskell, which I hope to document in a Haddock compatible way and upload to Hackage at one point. I've read about testing using Cabal's frameworks, and also HUnit and Quickcheck, but it seems in all the tutorials I've read one makes a separate directory and puts the test cases in a separate file, importing the original file.
I understand this might be appropriate sometimes, but I also think for just short tests it's simpler to put them in the same file as the implementation. Indeed, the documentation goes with the implementation, so why not the tests?
Could someone point me to the best way to achieve this, ideally in a way that:
- Doesn't mess up the Haddock generation AND
- Doesn't bloat the library (i.e. when it's build in release mode the tests are ignored).
I know this is a bit of a vague question, even some links to some tutorials and/or code that does test cases like this would be appreciated.