[Haskell-cafe] Unit testing in Haskell

Isaac Jones ijones at syntaxpolice.org
Wed Jan 12 10:49:22 EST 2005

Matthew Roberts <mattr at ics.mq.edu.au> writes:

>> I find that I don't need unit testing frameworks.  A few features of
>> Haskell and the associated interpreters (ghci and hugs) combine to
>> make "unit testing as you go" really easy.  I just write a few tests
>> for each function I write and then some more module wide tests once
>> the whole module is finished.  Sometimes I need a little scaffolding
>> to be able to output complex data types (or type synonyms), but
>> often just deriving Show does the job!

It seems to me that if you're going to take the time to craft some
ad-hoc tests in the interpreter, you might as well take an extra few
seconds to put them into HUnit tests so you can make sure they still
pass later.  This gives you more confidence while you are refactoring
your code.



More information about the Haskell-Cafe mailing list