Module

Test.Assert

Package
purescript-assert
Repository
purescript/purescript-assert

#ASSERT Source

data ASSERT :: Effect

Assertion effect type.

#assert Source

assert :: forall e. Boolean -> Eff (assert :: ASSERT | e) Unit

Throws a runtime exception with message "Assertion failed" when the boolean value is false.

#assert' Source

assert' :: forall e. String -> Boolean -> Eff (assert :: ASSERT | e) Unit

Throws a runtime exception with the specified message when the boolean value is false.

#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