Bool assert
Bool assert
is the final way to cause a panic in Gleam, used for
writing test assertions. It is similar to let assert
, except instead
of asserting that a value matches a specific pattern, it asserts that a boolean
value evaluates to True
.
Like the other panicking keywords, the as
keyword can be used to
add a custom message to an assertion. This will be shown instead of the generic
"Assertion failed" message if the value evaluates to False
.
Bool assert
is designed to be used in test code, and should almost
never be used in applications or libraries.