
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? Thanks, Mike

Michael,
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. John

On 9 Aug 2009, at 22:52, Michael Mossey wrote:
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?
Take a look at both QuickCheck and HUnit. Bob
participants (3)
-
John Dorsey
-
Michael Mossey
-
Thomas Davie