{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DeriveGeneric #-}

module Distribution.Types.TestSuiteInterface (
    TestSuiteInterface(..),
) where

import Prelude ()
import Distribution.Compat.Prelude

import Distribution.Types.TestType
import Distribution.ModuleName
import Distribution.Version

-- | The test suite interfaces that are currently defined. Each test suite must
-- specify which interface it supports.
--
-- More interfaces may be defined in future, either new revisions or totally
-- new interfaces.
--
data TestSuiteInterface =

     -- | Test interface \"exitcode-stdio-1.0\". The test-suite takes the form
     -- of an executable. It returns a zero exit code for success, non-zero for
     -- failure. The stdout and stderr channels may be logged. It takes no
     -- command line parameters and nothing on stdin.
     --
     TestSuiteExeV10 Version FilePath

     -- | Test interface \"detailed-0.9\". The test-suite takes the form of a
     -- library containing a designated module that exports \"tests :: [Test]\".
     --
   | TestSuiteLibV09 Version ModuleName

     -- | A test suite that does not conform to one of the above interfaces for
     -- the given reason (e.g. unknown test type).
     --
   | TestSuiteUnsupported TestType
   deriving (TestSuiteInterface -> TestSuiteInterface -> Bool
(TestSuiteInterface -> TestSuiteInterface -> Bool)
-> (TestSuiteInterface -> TestSuiteInterface -> Bool)
-> Eq TestSuiteInterface
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TestSuiteInterface -> TestSuiteInterface -> Bool
$c/= :: TestSuiteInterface -> TestSuiteInterface -> Bool
== :: TestSuiteInterface -> TestSuiteInterface -> Bool
$c== :: TestSuiteInterface -> TestSuiteInterface -> Bool
Eq, (forall x. TestSuiteInterface -> Rep TestSuiteInterface x)
-> (forall x. Rep TestSuiteInterface x -> TestSuiteInterface)
-> Generic TestSuiteInterface
forall x. Rep TestSuiteInterface x -> TestSuiteInterface
forall x. TestSuiteInterface -> Rep TestSuiteInterface x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep TestSuiteInterface x -> TestSuiteInterface
$cfrom :: forall x. TestSuiteInterface -> Rep TestSuiteInterface x
Generic, ReadPrec [TestSuiteInterface]
ReadPrec TestSuiteInterface
Int -> ReadS TestSuiteInterface
ReadS [TestSuiteInterface]
(Int -> ReadS TestSuiteInterface)
-> ReadS [TestSuiteInterface]
-> ReadPrec TestSuiteInterface
-> ReadPrec [TestSuiteInterface]
-> Read TestSuiteInterface
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TestSuiteInterface]
$creadListPrec :: ReadPrec [TestSuiteInterface]
readPrec :: ReadPrec TestSuiteInterface
$creadPrec :: ReadPrec TestSuiteInterface
readList :: ReadS [TestSuiteInterface]
$creadList :: ReadS [TestSuiteInterface]
readsPrec :: Int -> ReadS TestSuiteInterface
$creadsPrec :: Int -> ReadS TestSuiteInterface
Read, Int -> TestSuiteInterface -> ShowS
[TestSuiteInterface] -> ShowS
TestSuiteInterface -> String
(Int -> TestSuiteInterface -> ShowS)
-> (TestSuiteInterface -> String)
-> ([TestSuiteInterface] -> ShowS)
-> Show TestSuiteInterface
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TestSuiteInterface] -> ShowS
$cshowList :: [TestSuiteInterface] -> ShowS
show :: TestSuiteInterface -> String
$cshow :: TestSuiteInterface -> String
showsPrec :: Int -> TestSuiteInterface -> ShowS
$cshowsPrec :: Int -> TestSuiteInterface -> ShowS
Show, Typeable, Typeable TestSuiteInterface
DataType
Constr
Typeable TestSuiteInterface
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g)
    -> TestSuiteInterface
    -> c TestSuiteInterface)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c TestSuiteInterface)
-> (TestSuiteInterface -> Constr)
-> (TestSuiteInterface -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c TestSuiteInterface))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c TestSuiteInterface))
-> ((forall b. Data b => b -> b)
    -> TestSuiteInterface -> TestSuiteInterface)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> TestSuiteInterface -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> TestSuiteInterface -> r)
-> (forall u.
    (forall d. Data d => d -> u) -> TestSuiteInterface -> [u])
-> (forall u.
    Int -> (forall d. Data d => d -> u) -> TestSuiteInterface -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d)
    -> TestSuiteInterface -> m TestSuiteInterface)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> TestSuiteInterface -> m TestSuiteInterface)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> TestSuiteInterface -> m TestSuiteInterface)
-> Data TestSuiteInterface
TestSuiteInterface -> DataType
TestSuiteInterface -> Constr
(forall b. Data b => b -> b)
-> TestSuiteInterface -> TestSuiteInterface
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> TestSuiteInterface
-> c TestSuiteInterface
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c TestSuiteInterface
forall a.
Typeable a
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u.
Int -> (forall d. Data d => d -> u) -> TestSuiteInterface -> u
forall u. (forall d. Data d => d -> u) -> TestSuiteInterface -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> TestSuiteInterface -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> TestSuiteInterface -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> TestSuiteInterface -> m TestSuiteInterface
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> TestSuiteInterface -> m TestSuiteInterface
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c TestSuiteInterface
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> TestSuiteInterface
-> c TestSuiteInterface
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c TestSuiteInterface)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c TestSuiteInterface)
$cTestSuiteUnsupported :: Constr
$cTestSuiteLibV09 :: Constr
$cTestSuiteExeV10 :: Constr
$tTestSuiteInterface :: DataType
gmapMo :: (forall d. Data d => d -> m d)
-> TestSuiteInterface -> m TestSuiteInterface
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> TestSuiteInterface -> m TestSuiteInterface
gmapMp :: (forall d. Data d => d -> m d)
-> TestSuiteInterface -> m TestSuiteInterface
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> TestSuiteInterface -> m TestSuiteInterface
gmapM :: (forall d. Data d => d -> m d)
-> TestSuiteInterface -> m TestSuiteInterface
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> TestSuiteInterface -> m TestSuiteInterface
gmapQi :: Int -> (forall d. Data d => d -> u) -> TestSuiteInterface -> u
$cgmapQi :: forall u.
Int -> (forall d. Data d => d -> u) -> TestSuiteInterface -> u
gmapQ :: (forall d. Data d => d -> u) -> TestSuiteInterface -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> TestSuiteInterface -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> TestSuiteInterface -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> TestSuiteInterface -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> TestSuiteInterface -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> TestSuiteInterface -> r
gmapT :: (forall b. Data b => b -> b)
-> TestSuiteInterface -> TestSuiteInterface
$cgmapT :: (forall b. Data b => b -> b)
-> TestSuiteInterface -> TestSuiteInterface
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c TestSuiteInterface)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c TestSuiteInterface)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c TestSuiteInterface)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c TestSuiteInterface)
dataTypeOf :: TestSuiteInterface -> DataType
$cdataTypeOf :: TestSuiteInterface -> DataType
toConstr :: TestSuiteInterface -> Constr
$ctoConstr :: TestSuiteInterface -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c TestSuiteInterface
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c TestSuiteInterface
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> TestSuiteInterface
-> c TestSuiteInterface
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> TestSuiteInterface
-> c TestSuiteInterface
$cp1Data :: Typeable TestSuiteInterface
Data)

instance Binary TestSuiteInterface
instance Structured TestSuiteInterface

instance NFData TestSuiteInterface where rnf :: TestSuiteInterface -> ()
rnf = TestSuiteInterface -> ()
forall a. (Generic a, GNFData (Rep a)) => a -> ()
genericRnf

instance Monoid TestSuiteInterface where
    mempty :: TestSuiteInterface
mempty  =  TestType -> TestSuiteInterface
TestSuiteUnsupported (String -> Version -> TestType
TestTypeUnknown String
forall a. Monoid a => a
mempty Version
nullVersion)
    mappend :: TestSuiteInterface -> TestSuiteInterface -> TestSuiteInterface
mappend = TestSuiteInterface -> TestSuiteInterface -> TestSuiteInterface
forall a. Semigroup a => a -> a -> a
(<>)

instance Semigroup TestSuiteInterface where
    TestSuiteInterface
a <> :: TestSuiteInterface -> TestSuiteInterface -> TestSuiteInterface
<> (TestSuiteUnsupported TestType
_) = TestSuiteInterface
a
    TestSuiteInterface
_ <> TestSuiteInterface
b                        = TestSuiteInterface
b