See Original text in context
multi sub ok(Mu , = '')
The ok
function marks a test as passed if the given $cond
evaluates to True
. It also accepts an optional description of the test as second argument.
my ; my ; ...;ok .success, 'HTTP response was successful';
In principle, you could use ok
for every kind of comparison test, by including the comparison in the expression passed to $cond
:
sub factorial() ;ok factorial(6) == 720, 'Factorial - small integer';
However, where possible it's better to use one of the specialized comparison test functions below, because they can print more helpful diagnostics output in case the comparison fails.