Reference

Assert

Assert equal

Input The actual value and the expected value.
Output True if the two values are equal. Throws an assertion error otherwise.

Signature

assert_equal(a: Equatable, b: Equatable): Boolean

Example

assert_equal(1 + 1, 2) // returns true
assert_equal(3, 2)     // Assertion error: "assert_equal" failed: expected 2, actual 3

Assert not equal

Input The actual value and the value it must differ from.
Output True if the two values differ. Throws an assertion error otherwise.

Signature

assert_notEqual(a: Equatable, b: Equatable): Boolean

Example

assert_notEqual(1, 2) // returns true
assert_notEqual(1, 1) // Assertion error: "assert_notEqual" failed: expected not 1, actual 1

Assert true

Input A boolean condition.
Output True if the condition is true. Throws an assertion error otherwise.

Signature

assert_true(a: Boolean): Boolean

Example

assert_true(str_startsWith("abc", "a")) // returns true
assert_true(false)                      // Assertion error: "assert_true" failed: expected true, actual false

Assert false

Input A boolean condition.
Output True if the condition is false. Throws an assertion error otherwise.

Signature

assert_false(a: Boolean): Boolean

Example

assert_false(str_isEmpty("abc")) // returns true
assert_false(true)               // Assertion error: "assert_false" failed: expected false, actual true

Assert throws

Input An expression expected to raise an error.
Output True if evaluating the expression raises a runtime error. Throws an assertion error otherwise.

Signature

assert_throws(a: Any): Boolean

Example

assert_throws(to_number("not a number")) // returns true
assert_throws(42)                        // Assertion error: "assert_throws" failed: expected a thrown error, actual 42