Assertion
assert
[assert: condition; message?]
Verifies that condition is true before continuing program execution.
If condition is false, raises a runtime error; otherwise, does nothing.
The message displayed in the runtime error can be customized by passing a string to message.
Parameters
condition ← bool
The condition to check.
message ← string (optional)
The error message to display if the condition is not satisfied.
Examples
# does absolutely nothing
[assert: @true]
# [assertion error] assertion failed: condition was false
[assert: @false]
# [assertion error] ooooops!
[assert: @false; "ooooops!"]
assert-not
[assert-not: condition; message?]
Verifies that condition is false before continuing program execution.
Like [assert], a custom error message can be provided.
assert-eq
[assert-eq: actual; expected; message?]
Verifies that expected and actual are equal before continuing program execution.
Like [assert], a custom error message can be provided.
Parameters
actual ← any
The actual value to test.
expected ← any
The expected value to test against.
message ← string
The error message to display if the condition is not satisfied.
assert-neq
[assert-neq: actual; unexpected; message?]
Verifies that unexpected and actual are not equal before continuing program execution.
Like [assert], a custom error message can be provided.
Parameters
actual ← any
The actual value to test.
unexpected ← any
The unexpected value to test against.
message ← string
The error message to display if the condition is not satisfied.