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(..)
, (~=?)
, (~?=)
, (~:)
, (~?)
, State(..)
, Counts(..)
, Path
, Node
, testCasePaths
, testCaseCount
, ReportStart
, ReportProblem
, performTest
)
import Data.Typeable
import Control.Monad.Trans
testCase :: TestName -> Assertion -> TestTree
testCase name = singleTest name . TestCase
newtype TestCase = TestCase Assertion
deriving Typeable
instance IsTest TestCase where
run _ (TestCase assertion) _ = do
hunitResult <- performTestCase assertion
return $
case hunitResult of
Nothing ->
Result
{ resultSuccessful = True
, resultDescription = ""
}
Just (_, message) ->
Result
{ resultSuccessful = False
, resultDescription = message
}
testOptions = return []