Safe Haskell | None |
---|
Unittest helpers for TemplateHaskell components.
Synopsis
- propPrefix :: String
- casePrefix :: String
- case2Pfx :: String
- simplifyName :: String -> String -> String
- runProp :: Testable prop => String -> prop -> Test
- runCase :: String -> Assertion -> Test
- run :: Name -> Q Exp
- mapSlashes :: String -> String
- testSuite :: String -> [Name] -> Q [Dec]
- mkConsArbitrary :: (Name, [a]) -> Exp
- conInfo :: Con -> (Name, [Type])
- mkRegularArbitrary :: Name -> [Con] -> Q [Dec]
- genArbitrary :: Name -> Q [Dec]
Documentation
propPrefix :: String Source #
Test property prefix.
casePrefix :: String Source #
Test case prefix.
simplifyName :: String -> String -> String Source #
Tries to drop a prefix from a string.
runProp :: Testable prop => String -> prop -> Test Source #
Builds a test from a QuickCheck property.
Runs the correct test provider for a given test, based on its name (not very nice, but...).
mapSlashes :: String -> String Source #
Convert slashes in a name to underscores.
mkConsArbitrary :: (Name, [a]) -> Exp Source #
Builds an arbitrary value for a given constructor. This doesn't use the actual types of the fields, since we expect arbitrary instances for all of the types anyway, we only care about the number of fields.
mkRegularArbitrary :: Name -> [Con] -> Q [Dec] Source #
Builds an arbitrary instance for a regular data type (i.e. not Bounded).
genArbitrary :: Name -> Q [Dec] Source #
Builds a default Arbitrary instance for a type. This requires that all members are of types that already have Arbitrary instances, and that the arbitrary instances are well behaved (w.r.t. recursive data structures, or similar concerns). In that sense, this is not appropriate for all data types, just those that are simple but very repetitive or have many simple fields.