Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

20 lines (12 sloc) 0.524 kB
use v6;
use Test;
plan 6;
sub f($x) returns Int { return $x };
ok &f.returns === Int, 'sub f returns Int can be queried for its return value';
ok &f.of === Int, 'sub f returns Int can be queried for its return value (.of)';
lives_ok { f(3) }, 'type check allows good return';
dies_ok { f('m') }, 'type check forbids bad return';
sub g($x) returns Int { $x };
lives_ok { g(3) }, 'type check allows good implicit return';
dies_ok { g('m') }, 'type check forbids bad implicitreturn';
# vim: ft=perl6
Jump to Line
Something went wrong with that request. Please try again.