The require forms check the same way and, when the check fails, return from the procedure
they are written in (which must return nothing). Use them when the rest of the test needs the
check to hold. In a helper that returns a value, use the expect form instead.
items: [..] int;
array_add(*items, 1);
require(items.count == 1);
expect_equal(items[0], 1);- condition: what must be true.
- message: what to report instead of the default.
- loc: where the check is written, shown when it fails. Leave the default.
require :: (condition: bool, message := "", loc := #caller_location)
The require forms check the same way and, when the check fails, return from the procedure
they are written in (which must return nothing). Use them when the rest of the test needs the
check to hold. In a helper that returns a value, use the expect form instead.
Parameters
- condition: bool
- what must be true.
- message := ""
- what to report instead of the default.
- loc := #caller_location
- where the check is written, shown when it fails. Leave the default.
items: [..] int;
array_add(*items, 1);
require(items.count == 1);
expect_equal(items[0], 1);