Module

Test.Assert

Package
purescript-assert
Repository
purescript/purescript-assert

#assert Source

assert :: Boolean -> Effect Unit

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

#assert' Source

assert' :: String -> Boolean -> Effect Unit

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

#assertEqual Source

assertEqual :: forall a. Eq a => Show a => { actual :: a, expected :: a } -> Effect Unit

Compares the expected and actual values for equality and throws a runtime exception when the values are not equal.

The message indicates the expected value and the actual value.

#assertEqual' Source

assertEqual' :: forall a. Eq a => Show a => String -> { actual :: a, expected :: a } -> Effect Unit

Compares the expected and actual values for equality and throws a runtime exception with the specified message when the values are not equal.

The message also indicates the expected value and the actual value.

#assertFalse Source

assertFalse :: Boolean -> Effect Unit

Throws a runtime exception when the value is true.

The message indicates the expected value (false) and the actual value (true).

#assertFalse' Source

assertFalse' :: String -> Boolean -> Effect Unit

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

The message also indicates the expected value (false) and the actual value (true).

#assertThrows Source

assertThrows :: forall a. (Unit -> a) -> Effect 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 Effect a can be tested with catchException instead.

#assertThrows' Source

assertThrows' :: forall a. String -> (Unit -> a) -> Effect 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 Effect a can be tested with catchException instead.

#assertTrue Source

assertTrue :: Boolean -> Effect Unit

Throws a runtime exception when the value is false.

The message indicates the expected value (true) and the actual value (false).

#assertTrue' Source

assertTrue' :: String -> Boolean -> Effect Unit

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

The message also indicates the expected value (true) and the actual value (false).

Modules
Test.Assert