Skip to main content

Assertions

Assertions are used for validations. Assertions either pass or abort the execution, making them useful to immediately jump out of a test if certain validation fails.

ZWL currently supports only basic assertions, more of them will be introduced later.

assertTrue/assertFalse#

Validates the given expression evaluates to a boolean value true or false. Examples:

assertTrue(1 == 2) # reports assertion failure
assertFalse(length('hello world') > 0) # reports assertion failure
assertTrue(!false || false) # passes
# An optional failure message can be given as 2nd argument that will be printed#  instead of the standard message should the assertion fails.assertTrue(containsString('hello world', 'earth'), "Doesn't contain required term")