]>
Dogcows Code - chaz/p5-Return-Type-Lexical/blob - t/basic.t
9 use Types
::Standard
qw(Int);
12 use Return
::Type
::Lexical
;
13 sub foo
:ReturnType
(Int
) { 'not an int' }
14 no Return
::Type
::Lexical
;
15 sub bar
:ReturnType
(Int
) { 'not an int' }
16 use Return
::Type
::Lexical check
=> 0;
17 sub baz
:ReturnType
(Int
) { 'not an int' }
20 dies_ok
{ my $dummy = foo
() } 'return type enforced';
21 lives_and
{ my $dummy = bar
(); is $dummy, 'not an int' } 'return type not enforced';
22 lives_and
{ my $dummy = baz
(); is $dummy, 'not an int' } 'return type not enforced';
23 dies_ok
{ my $dummy = Other
::qux
() } 'return type enforced when using Return::Type directly';
30 use Types
::Standard
qw(Int);
33 sub qux
:ReturnType
(Int
) { 'not an int' }
This page took 0.036484 seconds and 4 git commands to generate.