skeletest
Safe HaskellNone
LanguageGHC2021

Skeletest.Internal.Spec

Synopsis

Spec interface

type Spec = Spec' () Source #

data SpecTree Source #

Constructors

SpecGroup 
SpecTest 

Fields

runSpecs :: Hooks -> SpecRegistry -> IO Bool Source #

Run the given Specs and return whether all of the tests passed.

Entrypoint

data SpecInfo Source #

Constructors

SpecInfo 

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

prop :: String -> Property -> Spec Source #

Define a property test.

describe "User" $ do
  prop "decode . encode === Just" $ do
    let genUser = ...
    (decode . encode) P.=== Just `shouldSatisfy` P.isoWith genUser

Modifiers

xfail :: String -> Spec -> Spec Source #

Mark the given spec as expected to fail. 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.

Can be selected with the marker @skip

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

Instances details
IsMarker AnonMarker Source # 
Instance details

Defined in Skeletest.Internal.Markers

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