From fa7ec6d407efc1c90b78efc6d61fcd5f88ef6790 Mon Sep 17 00:00:00 2001 From: Neil Brown Date: Tue, 15 Jan 2008 18:09:49 +0000 Subject: [PATCH] Added a helper function (assertEqualCustomShow) to the TestUtils module --- common/TestUtils.hs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/common/TestUtils.hs b/common/TestUtils.hs index d324ab7..dc4a67b 100644 --- a/common/TestUtils.hs +++ b/common/TestUtils.hs @@ -457,3 +457,8 @@ assertEitherFail testName result = case result of Left _ -> return () 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