Test.Assert
- Package
- purescript-assert
- Repository
- purescript/purescript-assert
#assertThrows Source
assertThrows :: forall a e. (Unit -> a) -> Eff (assert :: ASSERT | e) Unit
Throws a runtime exception with message "Assertion failed: An error should have been thrown", unless the argument throws an exception when evaluated.
This function is specifically for testing unsafe pure code; for example,
to make sure that an exception is thrown if a precondition is not
satisfied. Functions which use Eff (err :: EXCEPTION | eff) a
can be
tested with catchException
instead.
#assertThrows' Source
assertThrows' :: forall a e. String -> (Unit -> a) -> Eff (assert :: ASSERT | e) Unit
Throws a runtime exception with the specified message, unless the argument throws an exception when evaluated.
This function is specifically for testing unsafe pure code; for example,
to make sure that an exception is thrown if a precondition is not
satisfied. Functions which use Eff (err :: EXCEPTION | eff) a
can be
tested with catchException
instead.
- Modules
- Test.
Assert