sub ok
Documentation for sub ok
assembled from the following types:
module Test
From Test
(Test) sub ok
Defined as:
multi sub ok(Mu , = '')
The ok
function marks a test as passed if the given $value
evaluates to True
. The nok
function marks a test as passed if the given value evaluates to False
. Both functions accept an optional description of the test as second parameter.
my ; my ; ...;ok .success, 'HTTP response was successful';nok .error, 'Query completed without error';
In principle, you could use ok
for every kind of comparison test, by including the comparison in the expression passed to $value
:
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.