[Haskell-beginners] HUnit - testing for failed pattern match

Xavier Shay xavier-list at rhnh.net
Tue Feb 22 11:59:12 CET 2011


Hello,

Given the following contrived function:

   giveMeThree x
   | x == 3 = True

How do I test with HUnit that 2 is invalid input?

   giveMeThreeTests =
     [ "Likes 3" ~: True ~=? giveMeThree 3
     , "Dislikes 2" ~: ..... -- what?
     ]

I couldn't find anything mentioned in the HUnit user guide. References 
to appropriate documentation appreciated.

Cheers,
Xavier



More information about the Beginners mailing list