| Safe Haskell | None |
|---|---|
| Language | GHC2021 |
Skeletest.Internal.Spec
Synopsis
- type Spec = SpecM ()
- data SpecM a
- data SpecTree
- = SpecTree_Group { }
- | SpecTree_Test SpecTest
- data SpecRunner
- newSpecRunner :: SpecRegistry -> IO SpecRunner
- type SpecRegistry = [SpecInfo]
- data SpecInfo = SpecInfo {}
- describe :: String -> Spec -> Spec
- class MonadIO m => Testable (m :: Type -> Type) where
- runTestable :: m () -> IO TestResult
- test :: Testable m => String -> m () -> Spec
- it :: String -> IO () -> Spec
- xfail :: String -> Spec -> Spec
- skip :: String -> Spec -> Spec
- focus :: Spec -> Spec
- markManual :: Spec -> Spec
- class (Show a, Typeable a) => IsMarker a where
- getMarkerName :: a -> String
- withMarkers :: [String] -> Spec -> Spec
- withMarker :: IsMarker a => a -> Spec -> Spec
- skipTest :: MonadIO m => String -> m a
- specTreePlugin :: Plugin
Spec interface
Constructors
| SpecTree_Group | |
| SpecTree_Test SpecTest | |
Instances
| HasField "runGroup" SpecRunner (TestInfo -> Text -> [SpecTree] -> IO TestExitCode) Source # | |
Defined in Skeletest.Internal.Spec Methods getField :: SpecRunner -> TestInfo -> Text -> [SpecTree] -> IO TestExitCode # | |
| HasField "runTrees" SpecRunner (TestInfo -> [SpecTree] -> IO TestExitCode) Source # | |
Defined in Skeletest.Internal.Spec Methods getField :: SpecRunner -> TestInfo -> [SpecTree] -> IO TestExitCode # | |
Execution
data SpecRunner Source #
Instances
newSpecRunner :: SpecRegistry -> IO SpecRunner Source #
Entrypoint
type SpecRegistry = [SpecInfo] Source #
Instances
| HasField "run" SpecRunner (SpecRegistry -> IO TestExitCode) Source # | |
Defined in Skeletest.Internal.Spec Methods getField :: SpecRunner -> SpecRegistry -> IO TestExitCode # | |
| HasField "runFile" SpecRunner (SpecInfo -> IO TestExitCode) Source # | |
Defined in Skeletest.Internal.Spec Methods getField :: SpecRunner -> SpecInfo -> IO TestExitCode # | |
Defining a Spec
class MonadIO m => Testable (m :: Type -> Type) where Source #
Minimal complete definition
Methods
runTestable :: m () -> IO TestResult Source #
Instances
| Testable IO Source # | |
Defined in Skeletest.Assertions Methods runTestable :: IO () -> IO TestResult Source # context :: String -> IO a -> IO a Source # throwFailure :: AssertionFail -> IO a Source # | |
| Testable PropertyM Source # | |
Defined in Skeletest.Prop.Internal Methods runTestable :: PropertyM () -> IO TestResult Source # context :: String -> PropertyM a -> PropertyM a Source # throwFailure :: AssertionFail -> PropertyM a Source # | |
it :: String -> IO () -> Spec Source #
Define an IO-based test.
Should typically be written to be read as full sentences in traditional BDD style: https://en.wikipedia.org/wiki/Behavior-driven_development.
describe "User" $ do
it "can be checked for equality" $ do
user1 shouldBe user1
Modifiers
xfail :: String -> Spec -> Spec Source #
Mark the given spec as expected to fail with the given description. Fails tests if they unexpectedly pass.
Can be selected with the marker @xfail
skip :: String -> Spec -> Spec Source #
Skip all tests in the given spec with the given description.
Can be selected with the marker @skip
focus :: Spec -> Spec Source #
Warning: focus should only be used in development
If at least one test is focused, skip all unfocused tests.
This definition includes a WARNING so that CI errors if it's accidentally
committed (assuming CI runs with -Wall -Werror).
Since: 0.3.4
markManual :: Spec -> Spec Source #
Mark tests as tests that should only be run when explicitly specified on the command line.
Markers
class (Show a, Typeable a) => IsMarker a where Source #
Methods
getMarkerName :: a -> String Source #
The name of the marker that can be selected with @name syntax.
Marker names must only include alphanumeric characters, hyphens, underscores, and periods.
Instances
| IsMarker AnonMarker Source # | |
Defined in Skeletest.Internal.Markers Methods getMarkerName :: AnonMarker -> String Source # | |
| IsMarker MarkerFocus Source # | |
Defined in Skeletest.Internal.Spec.Tree Methods getMarkerName :: MarkerFocus -> String Source # | |
| IsMarker MarkerManual Source # | |
Defined in Skeletest.Internal.Spec.Tree Methods getMarkerName :: MarkerManual -> String Source # | |
| IsMarker MarkerSkip Source # | |
Defined in Skeletest.Internal.Spec.Tree Methods getMarkerName :: MarkerSkip -> String Source # | |
| IsMarker MarkerXFail Source # | |
Defined in Skeletest.Internal.Spec.Tree Methods getMarkerName :: MarkerXFail -> String Source # | |
withMarkers :: [String] -> Spec -> Spec Source #
Adds the given names as plain markers to all tests in the given spec.
See getMarkerName.
withMarker :: IsMarker a => a -> Spec -> Spec Source #
Adds the given marker to all the tests in the given spec.
Useful for selecting tests from the command line or identifying tests in hooks
Runtime functionality
skipTest :: MonadIO m => String -> m a Source #
Like skip, except allows skipping tests at runtime.
Since: 0.4.0