Jesse asked about getting t/pugs/operator/arith.t to run
on Rakudo, as written arith.t depends on the ".nextwith"
capability from S06. For example:
sub tryok ($ok, $todo) {
if ($todo) {
&ok.nextwith($ok,$todo, :todo);
} else {
&ok.nextwith($ok);
}
}
I'm of the opinion that we shouldn't require .nextwith to
be implemented for testing something basic like arithmetics,
so if we keep the above I propose changing &ok.nextwith() to
ok() calls for now.
In general, I think that tests should only need a rather
limited set of functions and Perl 6 features, and something
like .nextwith seems to fall outside of that. So as far
as we can, I think the test suite ought to stick to things
like:
ok($cond)
ok($cond, $desc)
is($got, $expected)
is($got, $expected, $desc)
isnt($got, $expected)
isnt($got, $expected, $desc)
is_approx($got, $expected)
is_approx($got, $expected, $desc)
Note that in the test suite 'todo' and 'skip' are often
handled by fudge as opposed to being an optional argument
to ok().
In the case of arith.t, I don't quite see the need for
the tryok() definition and tryeq(). It seems that it
would be much cleaner and more consistent for arith.t
to use
is 13 % 4, 1;
is -13 % 4, 3;
is_approx 13e21 % 4e21 - 1e21, 0;
is_approx -13e21 % 4e21 - 3e21, 0;
instead of
tryeq 13 % 4, 1;
tryeq -13 % 4, 3;
tryok abs( 13e21 % 4e21 - 1e21) < $limit;
tryok abs(-13e21 % 4e21 - 3e21) < $limit;
and locally defined try* subs. (There's also the point
that 'try' is a keyword in Perl 6, and 'tryeq' and 'tryok'
don't seem to have anything obvious to do with that 'try'.)
Pm