1 {-# LANGUAGE DeriveDataTypeable #-}
2 {-# LANGUAGE DeriveGeneric #-}
3 {-# LANGUAGE OverloadedStrings #-}
5 module Distribution
.Types
.TestType
12 import Distribution
.Compat
.Prelude
13 import Distribution
.Version
16 import Distribution
.Parsec
17 import Distribution
.Pretty
18 import Text
.PrettyPrint
(char
, text
)
20 -- | The \"test-type\" field in the test suite stanza.
22 = -- | \"type: exitcode-stdio-x.y\"
24 |
-- | \"type: detailed-x.y\"
26 |
-- | Some unknown test type e.g. \"type: foo\"
27 TestTypeUnknown
String Version
28 deriving (Generic
, Show, Read, Eq
, Ord
, Typeable
, Data
)
30 instance Binary TestType
31 instance Structured TestType
33 instance NFData TestType
where rnf
= genericRnf
35 knownTestTypes
:: [TestType
]
41 testTypeExe
:: TestType
42 testTypeExe
= TestTypeExe
(mkVersion
[1, 0])
44 testTypeLib
:: TestType
45 testTypeLib
= TestTypeLib
(mkVersion
[0, 9])
47 instance Pretty TestType
where
48 pretty
(TestTypeExe ver
) = text
"exitcode-stdio-" <<>> pretty ver
49 pretty
(TestTypeLib ver
) = text
"detailed-" <<>> pretty ver
50 pretty
(TestTypeUnknown name ver
) = text name
<<>> char
'-' <<>> pretty ver
52 instance Parsec TestType
where
53 parsec
= parsecStandard
$ \ver name
-> case name
of
54 "exitcode-stdio" -> TestTypeExe ver
55 "detailed" -> TestTypeLib ver
56 _
-> TestTypeUnknown name ver