packages feed

paypal-adaptive-hoops-0.8.0.0: tests/Utils.hs

module Utils where

import Test.HUnit

assertJust :: String -> Maybe a -> IO a
assertJust s a =
  case a of
    Nothing -> assertFailure s >> fail "assertJust failed"
    Just b  -> return b

assertRight :: (Show a) => Either a b -> IO b
assertRight a =
  case a of
    Left e  -> assertFailure (show e) >> fail "assertRight failed"
    Right b -> return b