Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

42 lines (31 sloc) 1.069 kb
use v6;
use Test;
plan 10;
# L<S06/Stub declarations>
lives_ok({sub thunder {...}}, 'sub foo {...} works');
eval_dies_ok('sub foo;', 'old Perl 5 "sub foo;" syntax is dead');
sub lightning {...}
# Maybe should be warns_ok
eval_dies_ok('lightning()', 'executing stub subroutine dies');
sub lightning {42}
is(lightning(), 42, 'redefining stub subroutine works without extra syntax');
sub hail {???}
# Should be warns_ok
lives_ok({hail()}, 'executing stub subroutine lives (should warn here)');
sub hail {47}
is(hail(), 47, 'redefining stub subroutine works without extra syntax');
sub wind {!!!}
eval_dies_ok('wind()', 'executing stub subroutine dies');
sub wind {17}
is(wind(), 17, 'redefining stub subroutine works without extra syntax');
sub hail {26}
# Maybe should be warns_ok
eval_dies_ok('sub hail {10}', 'redefining existing subroutine dies');
supersede sub hail {8}
is(hail(), 8, 'redefining non-stub subroutine with supersede');
# vim: ft=perl6
Jump to Line
Something went wrong with that request. Please try again.