packages feed

paypal-adaptive-hoops-0.13.1.0: tests/Import.hs

module Import (module Import) where

import           Control.Applicative as Import
import           Data.Aeson          as Import
import           Data.Foldable       as Import
import           Data.Monoid         as Import
import           Data.Text           as Import (Text)
import           Data.Traversable    as Import

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

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