require './test.pl';
}
-plan tests => 95;
+plan 'no_plan';
$SIG{__WARN__} = sub { die @_ };
@attrs = eval 'attributes::get $thunk';
is "@attrs", "locked method Z";
+# Test attributes on predeclared subroutines:
+eval 'package A; sub PS : lvalue';
+@attrs = eval 'attributes::get \&A::PS';
+is "@attrs", "lvalue";
+
# Test ability to modify existing sub's (or XSUB's) attributes.
eval 'package A; sub X { $_[0] } sub X : lvalue';
@attrs = eval 'attributes::get \&A::X';
like $@, qr/Can't declare scalar dereference in my/;
-my @code = qw(assertion lvalue locked method);
+my @code = qw(lvalue locked method);
+unshift @code, 'assertion' if $] >= 5.009;
my @other = qw(shared unique);
my %valid;
$valid{CODE} = {map {$_ => 1} @code};
$valid{SCALAR} = {map {$_ => 1} @other};
$valid{ARRAY} = $valid{HASH} = $valid{SCALAR};
+our ($scalar, @array, %hash);
foreach my $value (\&foo, \$scalar, \@array, \%hash) {
my $type = ref $value;
foreach my $negate ('', '-') {