Skip to main content

assertTrue

Tests to see if a value or expression is true

Syntax

assertTrue(var, optional message)

Example

obj = Object()
obj.name = "John"
obj.value = 23

// You can test a variable or variable property
= obj.value < 25
obj.test = b
assertTrue(b)
assertTrue(obj.test)

// You can test an expression
assertTrue(12<13)

If the test fails, an exception is thrown

The optional message on each function is a custom exception message that can be used if the test fails