3
use Test::More tests => 8;
5
use vars qw/@warnings/;
6
BEGIN { $SIG{__WARN__} = sub { push @warnings, @_ } }
8
BEGIN { is(@warnings, 0, 'no warnings yet') }
12
sub with_proto ($x, $y, $z) : proto($$$) {
18
sub with_lvalue () : lvalue proto() { $foo }
21
is(prototype('with_proto'), '$$$', ':proto attribute');
23
is(prototype('with_lvalue'), '', ':proto with other attributes');
25
is(with_lvalue, 1, 'other attributes still there');
27
BEGIN { is(@warnings, 0, 'no warnings with correct :proto declarations') }
29
sub invalid_proto ($x) : proto(invalid) { $x }
33
local $TODO = ':proto checks not yet implemented';
34
is(@warnings, 1, 'warning with illegal :proto');
37
qr/Illegal character in prototype for main::invalid_proto : invalid at /,
43
eval 'sub foo ($bar) : proto { $bar }';
44
like($@, qr/proto attribute requires argument/);