assert
Ensure that a condition is fulfilled.
Fails with an error if the condition is not fulfilled. Does not produce any output in the document.
If you wish to test equality between two values, see
assert.eq
and assert.ne
.
Example
#assert(1 < 2, message: "math broke")
ParametersParameters are the inputs to a function. They are specified in parentheses after the function name.
condition
The condition that must be true for the assertion to pass.
message
The error message when the assertion fails.
Default: none
assert.eq
function
Ensure that two values are equal.
Fails with an error if the first value is not equal to the second. Does not produce any output in the document.
Example
#assert.eq(10, 10)
ParametersParameters are the inputs to a function. They are specified in parentheses after the function name.
left
anyRequiredPositionalPositional parameters are specified in order, without names.
The first value to compare.
right
anyRequiredPositionalPositional parameters are specified in order, without names.
The second value to compare.
message
An optional message to display on error instead of the representations of the compared values.
Default: none
assert.ne
function
Ensure that two values are not equal.
Fails with an error if the first value is equal to the second. Does not produce any output in the document.
Example
#assert.ne(3, 4)
ParametersParameters are the inputs to a function. They are specified in parentheses after the function name.
left
anyRequiredPositionalPositional parameters are specified in order, without names.
The first value to compare.
right
anyRequiredPositionalPositional parameters are specified in order, without names.
The second value to compare.
message
An optional message to display on error instead of the representations of the compared values.
Default: none