module Test.Tasty.HUnit where

import Control.Monad (unless)
import qualified Test.HUnit as HU
import Test.Hspec

type Assertion = Expectation

(@?=) :: (HasCallStack, Show a, Eq a) => a -> a -> Expectation
@?= :: forall a. (HasCallStack, Show a, Eq a) => a -> a -> Expectation
(@?=) = a -> a -> Expectation
forall a. (HasCallStack, Show a, Eq a) => a -> a -> Expectation
shouldBe

testCase :: HasCallStack => String -> Expectation -> Spec
testCase :: HasCallStack => String -> Expectation -> Spec
testCase = String -> Expectation -> Spec
String -> Expectation -> SpecWith (Arg Expectation)
forall a.
(HasCallStack, Example a) =>
String -> a -> SpecWith (Arg a)
it

assertBool :: HasCallStack => String -> Bool -> Expectation
assertBool :: HasCallStack => String -> Bool -> Expectation
assertBool String
s Bool
b = Bool -> Expectation -> Expectation
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless Bool
b (Expectation -> Expectation) -> Expectation -> Expectation
forall a b. (a -> b) -> a -> b
$ HasCallStack => String -> Expectation
String -> Expectation
expectationFailure String
s

assertEqual :: (HasCallStack, Show a, Eq a) => String -> a -> a -> Expectation
assertEqual :: forall a.
(HasCallStack, Show a, Eq a) =>
String -> a -> a -> Expectation
assertEqual String
_s = a -> a -> Expectation
forall a. (HasCallStack, Show a, Eq a) => a -> a -> Expectation
shouldBe

-- We can't use expectationFailure because we need to return IO a
assertFailure :: HasCallStack => String -> IO a
assertFailure :: forall a. HasCallStack => String -> IO a
assertFailure = String -> IO a
forall a. HasCallStack => String -> IO a
HU.assertFailure