Assertions are used to make statements about the expected behaviour of the plugin under test.

To pass, a test must run without throwing any exceptions and with all assertions passing.

function t.assert(condition, message)

Call t.assert() to make an assertion in your test.

condition must be true, otherwise the assertion has failed and the test will be aborted.

message is optional, and if passed, will be included in the assertion failure message.

Using assertions

Assertions in your tests will look something like this:

t.assert(a === "Value");
t.assert(b === 42, "Meaning of life");

The first makes a simple statement that a variable should have the correct value. The second is similar, but includes a message to explain what is being tested to someone reading the test and in any failure message.