qr_gc.t is only TODO on 5.11.x+
[p5sagit/p5-mst-13.2.git] / t / op / attrs.t
index bf1ed84..5ba0fda 100644 (file)
@@ -148,21 +148,28 @@ eval 'my $$foo : bar = 1';
 like $@, qr/Can't declare scalar dereference in "my"/;
 
 
-my @code = qw(lvalue locked method);
-my @other = qw(shared unique);
+my @code = qw(lvalue method);
+my @other = qw(shared);
+my @deprecated = qw(locked unique);
 my %valid;
 $valid{CODE} = {map {$_ => 1} @code};
 $valid{SCALAR} = {map {$_ => 1} @other};
 $valid{ARRAY} = $valid{HASH} = $valid{SCALAR};
+my %deprecated;
+$deprecated{CODE} = { locked => 1 };
+$deprecated{ARRAY} = $deprecated{HASH} = $deprecated{SCALAR} = { unique => 1 };
 
 our ($scalar, @array, %hash);
 foreach my $value (\&foo, \$scalar, \@array, \%hash) {
     my $type = ref $value;
     foreach my $negate ('', '-') {
-       foreach my $attr (@code, @other) {
+       foreach my $attr (@code, @other, @deprecated) {
            my $attribute = $negate . $attr;
            eval "use attributes __PACKAGE__, \$value, '$attribute'";
-           if ($valid{$type}{$attr}) {
+           if ($deprecated{$type}{$attr}) {
+               like $@, qr/^Attribute "$attr" is deprecated at \(eval \d+\)/,
+                   "$type attribute $attribute deprecated";
+           } elsif ($valid{$type}{$attr}) {
                if ($attribute eq '-shared') {
                    like $@, qr/^A variable may not be unshared/;
                } else {