skeletest-0.4.0: Batteries-included, opinionated test framework
Safe HaskellNone
LanguageGHC2021

Skeletest.Internal.Spec

Synopsis

Spec interface

type Spec = SpecM () Source #

data SpecM a Source #

Instances

Instances details
Applicative SpecM Source # 
Instance details

Defined in Skeletest.Internal.Spec.Tree

Methods

pure :: a -> SpecM a #

(<*>) :: SpecM (a -> b) -> SpecM a -> SpecM b #

liftA2 :: (a -> b -> c) -> SpecM a -> SpecM b -> SpecM c #

(*>) :: SpecM a -> SpecM b -> SpecM b #

(<*) :: SpecM a -> SpecM b -> SpecM a #

Functor SpecM Source # 
Instance details

Defined in Skeletest.Internal.Spec.Tree

Methods

fmap :: (a -> b) -> SpecM a -> SpecM b #

(<$) :: a -> SpecM b -> SpecM a #

Monad SpecM Source # 
Instance details

Defined in Skeletest.Internal.Spec.Tree

Methods

(>>=) :: SpecM a -> (a -> SpecM b) -> SpecM b #

(>>) :: SpecM a -> SpecM b -> SpecM b #

return :: a -> SpecM a #

data SpecTree Source #

Instances

Instances details
HasField "runGroup" SpecRunner (TestInfo -> Text -> [SpecTree] -> IO TestExitCode) Source # 
Instance details

Defined in Skeletest.Internal.Spec

HasField "runTrees" SpecRunner (TestInfo -> [SpecTree] -> IO TestExitCode) Source # 
Instance details

Defined in Skeletest.Internal.Spec

Execution

data SpecRunner Source #

Instances

Instances details
HasField "printSummary" SpecRunner (IO ()) Source # 
Instance details

Defined in Skeletest.Internal.Spec

Methods

getField :: SpecRunner -> IO () #

HasField "run" SpecRunner (SpecRegistry -> IO TestExitCode) Source # 
Instance details

Defined in Skeletest.Internal.Spec

HasField "runFile" SpecRunner (SpecInfo -> IO TestExitCode) Source # 
Instance details

Defined in Skeletest.Internal.Spec

HasField "runGroup" SpecRunner (TestInfo -> Text -> [SpecTree] -> IO TestExitCode) Source # 
Instance details

Defined in Skeletest.Internal.Spec

HasField "runTest" SpecRunner (TestInfo -> SpecTest -> IO TestExitCode) Source # 
Instance details

Defined in Skeletest.Internal.Spec

HasField "runTrees" SpecRunner (TestInfo -> [SpecTree] -> IO TestExitCode) Source # 
Instance details

Defined in Skeletest.Internal.Spec

Entrypoint

data SpecInfo Source #

Constructors

SpecInfo 

Fields

Instances

Instances details
HasField "run" SpecRunner (SpecRegistry -> IO TestExitCode) Source # 
Instance details

Defined in Skeletest.Internal.Spec

HasField "runFile" SpecRunner (SpecInfo -> IO TestExitCode) Source # 
Instance details

Defined in Skeletest.Internal.Spec

Defining a Spec

describe :: String -> Spec -> Spec Source #

The entity or concept being tested.

class MonadIO m => Testable (m :: Type -> Type) where Source #

Minimal complete definition

runTestable, context, throwFailure

Methods

runTestable :: m () -> IO TestResult Source #

Instances

Instances details
Testable IO Source # 
Instance details

Defined in Skeletest.Assertions

Testable PropertyM Source # 
Instance details

Defined in Skeletest.Prop.Internal

test :: Testable m => String -> m () -> Spec 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.

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

Plugin