module Test.Tasty.HUnit
( testCase
, module Test.HUnit.Base
) where
import Test.Tasty.Providers
import qualified Test.HUnit.Base
import Test.HUnit.Lang
import Test.HUnit.Base hiding
( Test(..)
, Testable(..)
, (~=?)
, (~?=)
, (~:)
, (~?)
, State(..)
, Counts(..)
, Path
, Node
, testCasePaths
, testCaseCount
, ReportStart
, ReportProblem
, performTest
)
import Data.Typeable
import Control.Monad.Trans
import Control.Exception
testCase :: TestName -> Assertion -> TestTree
testCase name = singleTest name . TestCase
newtype TestCase = TestCase Assertion
deriving Typeable
instance IsTest TestCase where
run _ (TestCase assertion) _ = do
hunitResult <- try assertion
return $
case hunitResult of
Right {} -> testPassed ""
Left (HUnitFailure message) -> testFailed message
testOptions = return []