{-# LANGUAGE LambdaCase #-}
module Test.Tasty.Inspection.Internal (CheckResult(..)) where
import Test.Tasty.Providers (IsTest(..), testPassed, testFailed)
data CheckResult
= ResSuccess
| ResSuccessWithMessage String
| ResFailure String
instance IsTest CheckResult where
run :: OptionSet -> CheckResult -> (Progress -> IO ()) -> IO Result
run = (CheckResult -> (Progress -> IO ()) -> IO Result)
-> OptionSet -> CheckResult -> (Progress -> IO ()) -> IO Result
forall a b. a -> b -> a
const ((CheckResult -> (Progress -> IO ()) -> IO Result)
-> OptionSet -> CheckResult -> (Progress -> IO ()) -> IO Result)
-> (CheckResult -> (Progress -> IO ()) -> IO Result)
-> OptionSet
-> CheckResult
-> (Progress -> IO ())
-> IO Result
forall a b. (a -> b) -> a -> b
$ IO Result -> (Progress -> IO ()) -> IO Result
forall a b. a -> b -> a
const (IO Result -> (Progress -> IO ()) -> IO Result)
-> (CheckResult -> IO Result)
-> CheckResult
-> (Progress -> IO ())
-> IO Result
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Result -> IO Result
forall a. a -> IO a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Result -> IO Result)
-> (CheckResult -> Result) -> CheckResult -> IO Result
forall b c a. (b -> c) -> (a -> b) -> a -> c
. \case
CheckResult
ResSuccess -> String -> Result
testPassed String
""
ResSuccessWithMessage String
msg -> String -> Result
testPassed String
msg
ResFailure String
msg -> String -> Result
testFailed String
msg
testOptions :: Tagged CheckResult [OptionDescription]
testOptions = [OptionDescription] -> Tagged CheckResult [OptionDescription]
forall a. a -> Tagged CheckResult a
forall (f :: * -> *) a. Applicative f => a -> f a
pure []