
Jonathan Geddes wrote:
I know that much of my code could benefit from a property test or two on the more complex parts, but other than that I can't think that unit testing will improve my Haskell code/programming practice.
One other thing I should mention that is that since a lot of Haskell code is purely functional its actually easier to test than imperative code and particularly OO code. The difficulties in unit testing OO code is coaxing objects into the correct state to test a particular property. Usually this means a whole bunch of extra code to implement mock objects to feed the right data to the object under test. By contrast, much Haskell code is purely functional. With pure functions there is no state that needs to be set up. For testing pure functions, its just a matter of collecting a set of representative inputs and making sure the correct output is generated by each input. For example, Don Stewart reported that the XMonad developers conciously made as much of the XMonad code pure so it was more easily testable. Erik -- ---------------------------------------------------------------------- Erik de Castro Lopo http://www.mega-nerd.com/