nri-prelude-0.2.0.0: A Prelude inspired by the Elm programming language

Safe HaskellNone
LanguageHaskell2010

Expect.Task

Description

A library to create Expecations for Tasks.

Synopsis

Documentation

check :: Expectation -> Task TestFailure () Source #

Check an expectation in the middle of a do block.

task "Laundry gets done" <| do
    weightInKgs <- clothesInWasher
    check (weightInKgs |> Expect.atMost 8)
    soapInWasher
    startMachine

andCheck :: (a -> Expectation) -> Task TestFailure a -> Task TestFailure a Source #

Check a task returns an expected value, than pass that value on.

task "Greetings are friendly" <| do
    getGreeting
        |> andCheck (Expect.equal "Hi!")

succeeds :: Show err => Task err a -> Task TestFailure a Source #

Check a task succeeds.

task "solve rubicskube" <| do
    solveRubicsKube
        |> succeeds

fails :: Text -> Task TestFailure a Source #

Check a task fails.

task "chemistry experiment" <| do
    mixRedAndGreenLiquids
        |> fails