assertEq delegates to HUnit.assertEqual

HUnit.assertEqual gives a formatted diff, making it easier to see the differences between the two values at a glance.
This commit is contained in:
Daniel P. Brice 2022-05-10 13:24:21 -07:00 committed by GitHub
parent 0a273d5aae
commit 8028f1defd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -544,10 +544,8 @@ htmlQuery = htmlQuery' yedResponse []
-- @since 1.5.2
assertEq :: (HasCallStack, Eq a, Show a) => String -> a -> a -> YesodExample site ()
assertEq m a b =
liftIO $ HUnit.assertBool msg (a == b)
where msg = "Assertion: " ++ m ++ "\n" ++
"First argument: " ++ ppShow a ++ "\n" ++
"Second argument: " ++ ppShow b ++ "\n"
liftIO $ HUnit.assertEqual msg a b
where msg = "Assertion: " ++ m ++ "\n"
-- | Asserts that the two given values are not equal.
--