Added a helper function (assertEqualCustomShow) to the TestUtils module

This commit is contained in:
Neil Brown 2008-01-15 18:09:49 +00:00
parent d3fca1d610
commit fa7ec6d407

View File

@ -457,3 +457,8 @@ assertEitherFail testName result
= case result of = case result of
Left _ -> return () Left _ -> return ()
Right _ -> assertFailure $ testName ++ "; test expected to fail but passed" Right _ -> assertFailure $ testName ++ "; test expected to fail but passed"
assertEqualCustomShow :: Eq a => (a -> String) -> String -> a -> a -> Assertion
assertEqualCustomShow showFunc testName exp act
| exp == act = return ()
| otherwise = assertFailure $ testName ++ "\n" ++ "expected: " ++ showFunc exp ++ "\n but got: " ++ showFunc act