Module

Test.Assert

#assert

assert :: Boolean -> Effect Unit

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

#assert'

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

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

#assertEqual

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'

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

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'

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

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'

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

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'

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