[Haskell-beginners] unit tests
haskell at colquitt.org
Sun Aug 9 17:52:23 EDT 2009
> As I write Haskell code I find myself needing to write test code. If this
> test code were organized and documented, I could probably call it a set of
> unit tests. I'm trying to find some convention for naming functions and
> variables used in unit testing, deciding on location (in same module or a
> second module? same directory or sub-directory?), etc. Are there any
> Haskell community conventions?
quickcheck at least has the convention of calling testable properties by
names starting with 'prop_'. I think it's common to include them within a
package, but they're generally not compiled and run by default. Cabal has a
way to hook your tests in so that 'cabal test <package>' does the right
thing, but I don't remember, and my cabal fu isn't very strong.
I don't think there's any consensus on where within your package to put
them; you could put them in a test/ directory, or do anything that makes
sense within your project.
More information about the Beginners