unit tests

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

unit tests

Michael Mossey
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

Reply | Threaded
Open this post in threaded view
|

unit tests

John Dorsey-2
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

Reply | Threaded
Open this post in threaded view
|

unit tests

Thomas Davie
In reply to this post by Michael Mossey

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