summaryrefslogtreecommitdiff
path: root/t/lib
diff options
context:
space:
mode:
authorDagfinn Ilmari Mannsåker <ilmari@ilmari.org>2014-05-10 00:04:58 +0100
committerTony Cook <tony@develop-help.com>2014-06-04 15:21:08 +1000
commitb5adc3e5c5c4fa9a0d3b230a000a7644b71a169f (patch)
tree1089105ef847a284ea7b9ab3b9d04351f7cf86d2 /t/lib
parent92c6a5ec9f11d991a91d37e304ca77f7a73aa1f9 (diff)
downloadperl-b5adc3e5c5c4fa9a0d3b230a000a7644b71a169f.tar.gz
Disallow omitting % and @ on hash and array names
Really old Perl let you omit the @ on array names and the % on hash names in some spots. This has issued a deprecation warning since Perl 5.0, and is no longer permitted.
Diffstat (limited to 't/lib')
-rw-r--r--t/lib/croak/op46
-rw-r--r--t/lib/warnings/op32
2 files changed, 46 insertions, 32 deletions
diff --git a/t/lib/croak/op b/t/lib/croak/op
index 603f718350..d71be34691 100644
--- a/t/lib/croak/op
+++ b/t/lib/croak/op
@@ -82,3 +82,49 @@ exists argument is not a HASH or ARRAY element or a subroutine at - line 1.
exists &foo()
EXPECT
exists argument is not a subroutine name at - line 1.
+########
+# NAME push BAREWORD
+no warnings 'experimental';
+push FRED;
+EXPECT
+Type of arg 1 to push must be array (not constant item) at - line 2, near "FRED;"
+Execution of - aborted due to compilation errors.
+########
+# NAME pop BAREWORD
+no warnings 'experimental';
+pop FRED;
+EXPECT
+Type of arg 1 to pop must be array (not constant item) at - line 2, near "FRED;"
+Execution of - aborted due to compilation errors.
+########
+# NAME shift BAREWORD
+no warnings 'experimental';
+shift FRED;
+EXPECT
+Type of arg 1 to shift must be array (not constant item) at - line 2, near "FRED;"
+Execution of - aborted due to compilation errors.
+########
+# NAME unshift BAREWORD
+no warnings 'experimental';
+unshift FRED;
+EXPECT
+Type of arg 1 to unshift must be array (not constant item) at - line 2, near "FRED;"
+Execution of - aborted due to compilation errors.
+########
+# NAME keys BAREWORD
+@a = keys FRED ;
+EXPECT
+Type of arg 1 to keys must be hash (not constant item) at - line 1, near "FRED ;"
+Execution of - aborted due to compilation errors.
+########
+# NAME values BAREWORD
+@a = values FRED ;
+EXPECT
+Type of arg 1 to values must be hash (not constant item) at - line 1, near "FRED ;"
+Execution of - aborted due to compilation errors.
+########
+# NAME each BAREWORD
+@a = each FRED ;
+EXPECT
+Type of arg 1 to each must be hash (not constant item) at - line 1, near "FRED ;"
+Execution of - aborted due to compilation errors.
diff --git a/t/lib/warnings/op b/t/lib/warnings/op
index bca28186a2..f5fad9c7f3 100644
--- a/t/lib/warnings/op
+++ b/t/lib/warnings/op
@@ -61,18 +61,12 @@
format FRED =
.
- Array @%s missing the @ in argument %d of %s()
- push fred ;
-
push on reference is experimental [ck_fun]
pop on reference is experimental
shift on reference is experimental
unshift on reference is experimental
splice on reference is experimental
- Hash %%%s missing the %% in argument %d of %s()
- keys joe ;
-
Statement unlikely to be reached
(Maybe you meant system() when you said exec()?
exec "true" ; my $a
@@ -235,12 +229,6 @@ my @s = @f{"]", "a"};
@h{m ""};
use constant phoo => 1..3;
@h{+phoo}; # rv2av
-{
- no warnings 'deprecated';
- @h{each H};
- @h{values H};
- @h{keys H};
-}
@h{sort foo};
@h{reverse foo};
@h{caller 0};
@@ -284,12 +272,6 @@ my @s = @f["]", "a"];
@h[m ""];
use constant phoo => 1..3;
@h[+phoo]; # rv2av
-{
- no warnings 'deprecated';
- @h[each H];
- @h[values H];
- @h[keys H];
-}
@h[sort foo];
@h[reverse foo];
@h[caller 0];
@@ -1025,13 +1007,6 @@ format FRED =
EXPECT
Format FRED redefined at - line 5.
########
-# op.c
-push FRED;
-no warnings 'deprecated' ;
-push FRED;
-EXPECT
-Array @FRED missing the @ in argument 1 of push() at - line 2.
-########
# op.c [Perl_ck_fun]
$fred = [];
push $fred;
@@ -1053,13 +1028,6 @@ unshift on reference is experimental at - line 6.
splice on reference is experimental at - line 7.
########
# op.c
-@a = keys FRED ;
-no warnings 'deprecated' ;
-@a = keys FRED ;
-EXPECT
-Hash %FRED missing the % in argument 1 of keys() at - line 2.
-########
-# op.c
use warnings 'exec' ;
exec "$^X -e 1" ;
my $a