| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Expect.Task
Description
A library to create Expecations for Tasks.
Synopsis
- check :: Expectation -> Task TestFailure ()
- andCheck :: (a -> Expectation) -> Task TestFailure a -> Task TestFailure a
- succeeds :: Show err => Task err a -> Task TestFailure a
- fails :: Text -> Task TestFailure a
- data TestFailure
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
startMachineandCheck :: (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
|> succeedsfails :: Text -> Task TestFailure a Source #
Check a task fails.
task "chemistry experiment" <| do
mixRedAndGreenLiquids
|> failsdata TestFailure Source #
Error generated when a test expectation is not met.
Instances
| Show TestFailure Source # | |
Defined in Internal.TestResult Methods showsPrec :: Int -> TestFailure -> ShowS # show :: TestFailure -> String # showList :: [TestFailure] -> ShowS # | |
| Semigroup TestFailure Source # | |
Defined in Internal.TestResult Methods (<>) :: TestFailure -> TestFailure -> TestFailure # sconcat :: NonEmpty TestFailure -> TestFailure # stimes :: Integral b => b -> TestFailure -> TestFailure # | |
| Monoid TestFailure Source # | |
Defined in Internal.TestResult Methods mempty :: TestFailure # mappend :: TestFailure -> TestFailure -> TestFailure # mconcat :: [TestFailure] -> TestFailure # | |
| Exception TestFailure Source # | |
Defined in Internal.TestResult Methods toException :: TestFailure -> SomeException # fromException :: SomeException -> Maybe TestFailure # displayException :: TestFailure -> String # | |