Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Specifies the base tasty-sweet types and common class instance definitions for those types.
Synopsis
- type FileSuffix = String
- data CUBE = CUBE {}
- type ParameterPattern = (String, Maybe [String])
- type Separators = String
- mkCUBE :: CUBE
- prettyAssocNames :: [(String, String)] -> Maybe (Doc ann)
- prettyParamPatterns :: [ParameterPattern] -> Maybe (Doc ann)
- data Sweets = Sweets {}
- type Association = (String, FilePath)
- type NamedParamMatch = (String, ParamMatch)
- data Expectation = Expectation {}
- data ParamMatch
- paramMatchVal :: String -> ParamMatch -> Bool
- isExplicit :: ParamMatch -> Bool
- getExplicit :: ParamMatch -> Maybe String
- data SweetExplanation = SweetExpl {}
Documentation
type FileSuffix = String Source #
This is the type used to specify file suffixes. The synonym name is primarily used to indicate where this suffix specification is used.
Specifies the parameters and patterns to use when searching for
samples to build tests from. The mkCUBE
function should be used
to obtain a CUBE
structure initialized with overrideable
defaults.
The primary elements to specify are the rootName
and the
expectedSuffix
. With these two specifications (and possibly the
inputDir
) the Sugar
functionality will be similar to
a "golden" testing package.
The validParams
is an optional feature that is useful when
multiple expected results files are generated from a single
rootName
, differing by the specified parameters.
The associatedNames
is an optional feature that is useful for
when there are other files to be associated with a test in addition
to the rootFile
and the expectedFile
.
CUBE | |
|
type ParameterPattern = (String, Maybe [String]) Source #
Parameters are specified by their name and a possible list of valid values. If there is no list of valid values, any value is accepted for that parameter position. Parameters are listed in the order that they should appear in the filenames to be matched.
type Separators = String Source #
Separators for the path and suffix specifications. Any separator is accepted in any position between parameters and prior to the expected suffix. The synonym name is primarily used to indicate where this separators specification is intended to be used.
Generates the default CUBE
configuration; callers should override
individual fields as appropriate.
prettyAssocNames :: [(String, String)] -> Maybe (Doc ann) Source #
Pretty printing for a set of associated names
prettyParamPatterns :: [ParameterPattern] -> Maybe (Doc ann) Source #
Pretty printing for a list of parameter patterns
Each identified test input set is represented as a Sweets
object.. a Specifications With Existing Expected Testing Samples.
Sweets | |
|
type Association = (String, FilePath) Source #
The Association
specifies the name of the associated file entry
and the actual filepath of that associated file.
type NamedParamMatch = (String, ParamMatch) Source #
The NamedParamMatch
specifies the parameter name and the
corresponding value for the expected file found. These can be
extracted from the name of the expected file and the set of
ParameterPattern
entries, but they are presented in an associated
list format for easy utilization by the invoked test target.
data Expectation Source #
The Expectation
represents a valid test configuration based on
the set of provided files. The Expectation
consists of an
expected file which matches the rootFile
in the containing
Sweets
data object. The expectedFile
field is the name of the
file containing expected output, the expParamsMatch
field
specifies the ParameterPattern
matching values for this expected
file, and the associated
field provides a list of files
associated with this expected file.
Expectation | |
|
Instances
Eq Expectation Source # | |
Defined in Test.Tasty.Sugar.Types (==) :: Expectation -> Expectation -> Bool # (/=) :: Expectation -> Expectation -> Bool # | |
Show Expectation Source # | |
Defined in Test.Tasty.Sugar.Types showsPrec :: Int -> Expectation -> ShowS # show :: Expectation -> String # showList :: [Expectation] -> ShowS # | |
Pretty Expectation Source # | |
Defined in Test.Tasty.Sugar.Types pretty :: Expectation -> Doc ann # prettyList :: [Expectation] -> Doc ann # |
data ParamMatch Source #
Indicates the matching parameter value for this identified
expected test. If the parameter value is explicitly specified in
the expected filename, it is an Explicit
entry, otherwise it is
Assumed
(for each of the valid ParameterPattern
values) or
NotSpecified if there are no known ParameterPattern
values.
Explicit String | This parameter value was explicitly specified in the filename of the expected file. |
Assumed String | This parameter value was not specified in the filename of the
expected file, so the value is being synthetically supplied.
This is used for parameters that have known values but none is
present: an |
NotSpecified | This parameter value was not specified in the filename for the
expected file. In addition, the associated |
Instances
Eq ParamMatch Source # | |
Defined in Test.Tasty.Sugar.Types (==) :: ParamMatch -> ParamMatch -> Bool # (/=) :: ParamMatch -> ParamMatch -> Bool # | |
Show ParamMatch Source # | |
Defined in Test.Tasty.Sugar.Types showsPrec :: Int -> ParamMatch -> ShowS # show :: ParamMatch -> String # showList :: [ParamMatch] -> ShowS # | |
Pretty ParamMatch Source # | |
Defined in Test.Tasty.Sugar.Types pretty :: ParamMatch -> Doc ann # prettyList :: [ParamMatch] -> Doc ann # |
paramMatchVal :: String -> ParamMatch -> Bool Source #
The paramMatchVal
function is used to determine if a specific
value matches the corresponding ParamMatch
isExplicit :: ParamMatch -> Bool Source #
Predicate test returning true for Explicit param values.
getExplicit :: ParamMatch -> Maybe String Source #
Extracts explicit value or Nothing
data SweetExplanation Source #
The SweetExplanation
is the data type that contains the
description of the findSugar
process and
results.
Instances
Pretty SweetExplanation Source # | |
Defined in Test.Tasty.Sugar.Types pretty :: SweetExplanation -> Doc ann # prettyList :: [SweetExplanation] -> Doc ann # |