summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2000-02-21 01:37:35 +0000
committerJarkko Hietaniemi <jhi@iki.fi>2000-02-21 01:37:35 +0000
commitd0bc94aab7477307ee6c7ddb7187bcfc2e5c5fc2 (patch)
tree2e109be0afc317ca5046aaa6a4228e92162d9a4d /t
parent99819a14977e25f4ffd5fe19db3f3e492417275e (diff)
parent2ba999ece4e8727143f109b401921cec33e5b6dc (diff)
downloadperl-d0bc94aab7477307ee6c7ddb7187bcfc2e5c5fc2.tar.gz
Integrate with Sarathy.
p4raw-id: //depot/cfgperl@5176
Diffstat (limited to 't')
-rwxr-xr-xt/op/mkdir.t19
-rwxr-xr-xt/op/substr.t307
-rwxr-xr-xt/pragma/warn/9enabled390
-rw-r--r--t/pragma/warn/op62
-rw-r--r--t/pragma/warn/pp28
-rw-r--r--t/pragma/warn/pp_ctl36
-rw-r--r--t/pragma/warn/pp_hot12
-rw-r--r--t/pragma/warn/regcomp37
-rw-r--r--t/pragma/warn/regexec8
-rw-r--r--t/pragma/warn/sv8
-rw-r--r--t/pragma/warn/toke32
11 files changed, 692 insertions, 247 deletions
diff --git a/t/op/mkdir.t b/t/op/mkdir.t
index e9460239b2..cf8e55d75e 100755
--- a/t/op/mkdir.t
+++ b/t/op/mkdir.t
@@ -1,18 +1,15 @@
#!./perl
-# $RCSfile: mkdir.t,v $$Revision: 4.1 $$Date: 92/08/07 18:28:06 $
+print "1..9\n";
-print "1..7\n";
-
-if ($^O eq 'VMS') { # May as well test the library too
- unshift @INC, '../lib';
- require File::Path;
- File::Path::rmtree('blurfl');
-}
-else {
- $^O eq 'MSWin32' ? `del /s /q blurfl 2>&1` : `rm -rf blurfl`;
+BEGIN {
+ chdir 't' if -d 't';
+ unshift @INC, '../lib';
}
+use File::Path;
+rmtree('blurfl');
+
# tests 3 and 7 rather naughtily expect English error messages
$ENV{'LC_ALL'} = 'C';
$ENV{LANGUAGE} = 'C'; # GNU locale extension
@@ -24,3 +21,5 @@ print (-d 'blurfl' ? "ok 4\n" : "not ok 4\n");
print (rmdir('blurfl') ? "ok 5\n" : "not ok 5\n");
print (rmdir('blurfl') ? "not ok 6\n" : "ok 6\n");
print ($! =~ /cannot find|such|exist|not found/i ? "ok 7\n" : "# $!\nnot ok 7\n");
+print (mkdir('blurfl') ? "ok 8\n" : "not ok 8\n");
+print (rmdir('blurfl') ? "ok 9\n" : "not ok 9\n");
diff --git a/t/op/substr.t b/t/op/substr.t
index 8d31a9ae61..5764e67e7a 100755
--- a/t/op/substr.t
+++ b/t/op/substr.t
@@ -1,12 +1,14 @@
-#!./perl
-print "1..108\n";
+print "1..125\n";
#P = start of string Q = start of substr R = end of substr S = end of string
-$a = 'abcdefxyz';
-BEGIN { $^W = 1 };
+BEGIN {
+ unshift @INC, '../lib' if -d '../lib' ;
+}
+use warnings ;
+$a = 'abcdefxyz';
$SIG{__WARN__} = sub {
if ($_[0] =~ /^substr outside of string/) {
$w++;
@@ -19,139 +21,198 @@ $SIG{__WARN__} = sub {
}
};
-sub fail { !defined(shift) && $w-- };
+sub ok { print (($_[1] ? "" : "not ") . "ok $_[0]\n") }
+
+$FATAL_MSG = '^substr outside of string' ;
-print (substr($a,0,3) eq 'abc' ? "ok 1\n" : "not ok 1\n"); # P=Q R S
-print (substr($a,3,3) eq 'def' ? "ok 2\n" : "not ok 2\n"); # P Q R S
-print (substr($a,6,999) eq 'xyz' ? "ok 3\n" : "not ok 3\n"); # P Q S R
-print (fail(substr($a,999,999)) ? "ok 4\n" : "not ok 4\n"); # P R Q S
-print (substr($a,0,-6) eq 'abc' ? "ok 5\n" : "not ok 5\n"); # P=Q R S
-print (substr($a,-3,1) eq 'x' ? "ok 6\n" : "not ok 6\n"); # P Q R S
+ok 1, substr($a,0,3) eq 'abc'; # P=Q R S
+ok 2, substr($a,3,3) eq 'def'; # P Q R S
+ok 3, substr($a,6,999) eq 'xyz'; # P Q S R
+$b = substr($a,999,999) ; # warn # P R Q S
+ok 4, $w-- == 1 ;
+eval{substr($a,999,999) = "" ; };# P R Q S
+ok 5, $@ =~ /$FATAL_MSG/;
+ok 6, substr($a,0,-6) eq 'abc'; # P=Q R S
+ok 7, substr($a,-3,1) eq 'x'; # P Q R S
$[ = 1;
-print (substr($a,1,3) eq 'abc' ? "ok 7\n" : "not ok 7\n"); # P=Q R S
-print (substr($a,4,3) eq 'def' ? "ok 8\n" : "not ok 8\n"); # P Q R S
-print (substr($a,7,999) eq 'xyz' ? "ok 9\n" : "not ok 9\n"); # P Q S R
-print (fail(substr($a,999,999)) ? "ok 10\n" : "not ok 10\n");# P R Q S
-print (substr($a,1,-6) eq 'abc' ? "ok 11\n" : "not ok 11\n");# P=Q R S
-print (substr($a,-3,1) eq 'x' ? "ok 12\n" : "not ok 12\n"); # P Q R S
+ok 8, substr($a,1,3) eq 'abc' ; # P=Q R S
+ok 9, substr($a,4,3) eq 'def' ; # P Q R S
+ok 10, substr($a,7,999) eq 'xyz';# P Q S R
+$b = substr($a,999,999) ; # warn # P R Q S
+ok 11, $w-- == 1 ;
+eval{substr($a,999,999) = "" ; } ; # P R Q S
+ok 12, $@ =~ /$FATAL_MSG/;
+ok 13, substr($a,1,-6) eq 'abc' ;# P=Q R S
+ok 14, substr($a,-3,1) eq 'x' ; # P Q R S
$[ = 0;
substr($a,3,3) = 'XYZ';
-print $a eq 'abcXYZxyz' ? "ok 13\n" : "not ok 13\n";
+ok 15, $a eq 'abcXYZxyz' ;
substr($a,0,2) = '';
-print $a eq 'cXYZxyz' ? "ok 14\n" : "not ok 14\n";
+ok 16, $a eq 'cXYZxyz' ;
substr($a,0,0) = 'ab';
-print $a eq 'abcXYZxyz' ? "ok 15\n" : "not ok 15 $a\n";
+ok 17, $a eq 'abcXYZxyz' ;
substr($a,0,0) = '12345678';
-print $a eq '12345678abcXYZxyz' ? "ok 16\n" : "not ok 16\n";
+ok 18, $a eq '12345678abcXYZxyz' ;
substr($a,-3,3) = 'def';
-print $a eq '12345678abcXYZdef' ? "ok 17\n" : "not ok 17\n";
+ok 19, $a eq '12345678abcXYZdef';
substr($a,-3,3) = '<';
-print $a eq '12345678abcXYZ<' ? "ok 18\n" : "not ok 18\n";
+ok 20, $a eq '12345678abcXYZ<' ;
substr($a,-1,1) = '12345678';
-print $a eq '12345678abcXYZ12345678' ? "ok 19\n" : "not ok 19\n";
+ok 21, $a eq '12345678abcXYZ12345678' ;
$a = 'abcdefxyz';
-print (substr($a,6) eq 'xyz' ? "ok 20\n" : "not ok 20\n"); # P Q R=S
-print (substr($a,-3) eq 'xyz' ? "ok 21\n" : "not ok 21\n"); # P Q R=S
-print (fail(substr($a,999)) ? "ok 22\n" : "not ok 22\n"); # P R=S Q
-print (substr($a,0) eq 'abcdefxyz' ? "ok 23\n" : "not ok 23\n");# P=Q R=S
-print (substr($a,9) eq '' ? "ok 24\n" : "not ok 24\n"); # P Q=R=S
-print (substr($a,-11) eq 'abcdefxyz' ? "ok 25\n" : "not ok 25\n");# Q P R=S
-print (substr($a,-9) eq 'abcdefxyz' ? "ok 26\n" : "not ok 26\n"); # P=Q R=S
+ok 22, substr($a,6) eq 'xyz' ; # P Q R=S
+ok 23, substr($a,-3) eq 'xyz' ; # P Q R=S
+$b = substr($a,999,999) ; # warning # P R=S Q
+ok 24, $w-- == 1 ;
+eval{substr($a,999,999) = "" ; } ; # P R=S Q
+ok 25, $@ =~ /$FATAL_MSG/;
+ok 26, substr($a,0) eq 'abcdefxyz' ; # P=Q R=S
+ok 27, substr($a,9) eq '' ; # P Q=R=S
+ok 28, substr($a,-11) eq 'abcdefxyz'; # Q P R=S
+ok 29, substr($a,-9) eq 'abcdefxyz'; # P=Q R=S
$a = '54321';
-print (fail(substr($a,-7, 1)) ? "ok 27\n" : "not ok 27\n"); # Q R P S
-print (fail(substr($a,-7,-6)) ? "ok 28\n" : "not ok 28\n"); # Q R P S
-print (substr($a,-5,-7) eq '' ? "ok 29\n" : "not ok 29\n"); # R P=Q S
-print (substr($a, 2,-7) eq '' ? "ok 30\n" : "not ok 30\n"); # R P Q S
-print (substr($a,-3,-7) eq '' ? "ok 31\n" : "not ok 31\n"); # R P Q S
-print (substr($a, 2,-5) eq '' ? "ok 32\n" : "not ok 32\n"); # P=R Q S
-print (substr($a,-3,-5) eq '' ? "ok 33\n" : "not ok 33\n"); # P=R Q S
-print (substr($a, 2,-4) eq '' ? "ok 34\n" : "not ok 34\n"); # P R Q S
-print (substr($a,-3,-4) eq '' ? "ok 35\n" : "not ok 35\n"); # P R Q S
-print (substr($a, 5,-6) eq '' ? "ok 36\n" : "not ok 36\n"); # R P Q=S
-print (substr($a, 5,-5) eq '' ? "ok 37\n" : "not ok 37\n"); # P=R Q S
-print (substr($a, 5,-3) eq '' ? "ok 38\n" : "not ok 38\n"); # P R Q=S
-print (fail(substr($a, 7,-7)) ? "ok 39\n" : "not ok 39\n"); # R P S Q
-print (fail(substr($a, 7,-5)) ? "ok 40\n" : "not ok 40\n"); # P=R S Q
-print (fail(substr($a, 7,-3)) ? "ok 41\n" : "not ok 41\n"); # P R S Q
-print (fail(substr($a, 7, 0)) ? "ok 42\n" : "not ok 42\n"); # P S Q=R
-
-print (substr($a,-7,2) eq '' ? "ok 43\n" : "not ok 43\n"); # Q P=R S
-print (substr($a,-7,4) eq '54' ? "ok 44\n" : "not ok 44\n"); # Q P R S
-print (substr($a,-7,7) eq '54321' ? "ok 45\n" : "not ok 45\n");# Q P R=S
-print (substr($a,-7,9) eq '54321' ? "ok 46\n" : "not ok 46\n");# Q P S R
-print (substr($a,-5,0) eq '' ? "ok 47\n" : "not ok 47\n"); # P=Q=R S
-print (substr($a,-5,3) eq '543' ? "ok 48\n" : "not ok 48\n");# P=Q R S
-print (substr($a,-5,5) eq '54321' ? "ok 49\n" : "not ok 49\n");# P=Q R=S
-print (substr($a,-5,7) eq '54321' ? "ok 50\n" : "not ok 50\n");# P=Q S R
-print (substr($a,-3,0) eq '' ? "ok 51\n" : "not ok 51\n"); # P Q=R S
-print (substr($a,-3,3) eq '321' ? "ok 52\n" : "not ok 52\n");# P Q R=S
-print (substr($a,-2,3) eq '21' ? "ok 53\n" : "not ok 53\n"); # P Q S R
-print (substr($a,0,-5) eq '' ? "ok 54\n" : "not ok 54\n"); # P=Q=R S
-print (substr($a,2,-3) eq '' ? "ok 55\n" : "not ok 55\n"); # P Q=R S
-print (substr($a,0,0) eq '' ? "ok 56\n" : "not ok 56\n"); # P=Q=R S
-print (substr($a,0,5) eq '54321' ? "ok 57\n" : "not ok 57\n");# P=Q R=S
-print (substr($a,0,7) eq '54321' ? "ok 58\n" : "not ok 58\n");# P=Q S R
-print (substr($a,2,0) eq '' ? "ok 59\n" : "not ok 59\n"); # P Q=R S
-print (substr($a,2,3) eq '321' ? "ok 60\n" : "not ok 60\n"); # P Q R=S
-print (substr($a,5,0) eq '' ? "ok 61\n" : "not ok 61\n"); # P Q=R=S
-print (substr($a,5,2) eq '' ? "ok 62\n" : "not ok 62\n"); # P Q=S R
-print (substr($a,-7,-5) eq '' ? "ok 63\n" : "not ok 63\n"); # Q P=R S
-print (substr($a,-7,-2) eq '543' ? "ok 64\n" : "not ok 64\n");# Q P R S
-print (substr($a,-5,-5) eq '' ? "ok 65\n" : "not ok 65\n"); # P=Q=R S
-print (substr($a,-5,-2) eq '543' ? "ok 66\n" : "not ok 66\n");# P=Q R S
-print (substr($a,-3,-3) eq '' ? "ok 67\n" : "not ok 67\n"); # P Q=R S
-print (substr($a,-3,-1) eq '32' ? "ok 68\n" : "not ok 68\n");# P Q R S
+$b = substr($a,-7, 1) ; # warn # Q R P S
+ok 30, $w-- == 1 ;
+eval{substr($a,-7, 1) = "" ; }; # Q R P S
+ok 31, $@ =~ /$FATAL_MSG/;
+$b = substr($a,-7,-6) ; # warn # Q R P S
+ok 32, $w-- == 1 ;
+eval{substr($a,-7,-6) = "" ; }; # Q R P S
+ok 33, $@ =~ /$FATAL_MSG/;
+ok 34, substr($a,-5,-7) eq ''; # R P=Q S
+ok 35, substr($a, 2,-7) eq ''; # R P Q S
+ok 36, substr($a,-3,-7) eq ''; # R P Q S
+ok 37, substr($a, 2,-5) eq ''; # P=R Q S
+ok 38, substr($a,-3,-5) eq ''; # P=R Q S
+ok 39, substr($a, 2,-4) eq ''; # P R Q S
+ok 40, substr($a,-3,-4) eq ''; # P R Q S
+ok 41, substr($a, 5,-6) eq ''; # R P Q=S
+ok 42, substr($a, 5,-5) eq ''; # P=R Q S
+ok 43, substr($a, 5,-3) eq ''; # P R Q=S
+$b = substr($a, 7,-7) ; # warn # R P S Q
+ok 44, $w-- == 1 ;
+eval{substr($a, 7,-7) = "" ; }; # R P S Q
+ok 45, $@ =~ /$FATAL_MSG/;
+$b = substr($a, 7,-5) ; # warn # P=R S Q
+ok 46, $w-- == 1 ;
+eval{substr($a, 7,-5) = "" ; }; # P=R S Q
+ok 47, $@ =~ /$FATAL_MSG/;
+$b = substr($a, 7,-3) ; # warn # P Q S Q
+ok 48, $w-- == 1 ;
+eval{substr($a, 7,-3) = "" ; }; # P Q S Q
+ok 49, $@ =~ /$FATAL_MSG/;
+$b = substr($a, 7, 0) ; # warn # P S Q=R
+ok 50, $w-- == 1 ;
+eval{substr($a, 7, 0) = "" ; }; # P S Q=R
+ok 51, $@ =~ /$FATAL_MSG/;
+
+ok 52, substr($a,-7,2) eq ''; # Q P=R S
+ok 53, substr($a,-7,4) eq '54'; # Q P R S
+ok 54, substr($a,-7,7) eq '54321';# Q P R=S
+ok 55, substr($a,-7,9) eq '54321';# Q P S R
+ok 56, substr($a,-5,0) eq ''; # P=Q=R S
+ok 57, substr($a,-5,3) eq '543';# P=Q R S
+ok 58, substr($a,-5,5) eq '54321';# P=Q R=S
+ok 59, substr($a,-5,7) eq '54321';# P=Q S R
+ok 60, substr($a,-3,0) eq ''; # P Q=R S
+ok 61, substr($a,-3,3) eq '321';# P Q R=S
+ok 62, substr($a,-2,3) eq '21'; # P Q S R
+ok 63, substr($a,0,-5) eq ''; # P=Q=R S
+ok 64, substr($a,2,-3) eq ''; # P Q=R S
+ok 65, substr($a,0,0) eq ''; # P=Q=R S
+ok 66, substr($a,0,5) eq '54321';# P=Q R=S
+ok 67, substr($a,0,7) eq '54321';# P=Q S R
+ok 68, substr($a,2,0) eq ''; # P Q=R S
+ok 69, substr($a,2,3) eq '321'; # P Q R=S
+ok 70, substr($a,5,0) eq ''; # P Q=R=S
+ok 71, substr($a,5,2) eq ''; # P Q=S R
+ok 72, substr($a,-7,-5) eq ''; # Q P=R S
+ok 73, substr($a,-7,-2) eq '543';# Q P R S
+ok 74, substr($a,-5,-5) eq ''; # P=Q=R S
+ok 75, substr($a,-5,-2) eq '543';# P=Q R S
+ok 76, substr($a,-3,-3) eq ''; # P Q=R S
+ok 77, substr($a,-3,-1) eq '32';# P Q R S
$a = '';
-print (substr($a,-2,2) eq '' ? "ok 69\n" : "not ok 69\n"); # Q P=R=S
-print (substr($a,0,0) eq '' ? "ok 70\n" : "not ok 70\n"); # P=Q=R=S
-print (substr($a,0,1) eq '' ? "ok 71\n" : "not ok 71\n"); # P=Q=S R
-print (substr($a,-2,3) eq '' ? "ok 72\n" : "not ok 72\n"); # Q P=S R
-print (substr($a,-2) eq '' ? "ok 73\n" : "not ok 73\n"); # Q P=R=S
-print (substr($a,0) eq '' ? "ok 74\n" : "not ok 74\n"); # P=Q=R=S
+ok 78, substr($a,-2,2) eq ''; # Q P=R=S
+ok 79, substr($a,0,0) eq ''; # P=Q=R=S
+ok 80, substr($a,0,1) eq ''; # P=Q=S R
+ok 81, substr($a,-2,3) eq ''; # Q P=S R
+ok 82, substr($a,-2) eq ''; # Q P=R=S
+ok 83, substr($a,0) eq ''; # P=Q=R=S
+
+
+ok 84, substr($a,0,-1) eq ''; # R P=Q=S
+$b = substr($a,-2, 0) ; # warn # Q=R P=S
+ok 85, $w-- == 1 ;
+eval{substr($a,-2, 0) = "" ; }; # Q=R P=S
+ok 86, $@ =~ /$FATAL_MSG/;
+$b = substr($a,-2, 1) ; # warn # Q R P=S
+ok 87, $w-- == 1 ;
+eval{substr($a,-2, 1) = "" ; }; # Q R P=S
+ok 88, $@ =~ /$FATAL_MSG/;
-print (substr($a,0,-1) eq '' ? "ok 75\n" : "not ok 75\n"); # R P=Q=S
-print (fail(substr($a,-2,0)) ? "ok 76\n" : "not ok 76\n"); # Q=R P=S
-print (fail(substr($a,-2,1)) ? "ok 77\n" : "not ok 77\n"); # Q R P=S
-print (fail(substr($a,-2,-1)) ? "ok 78\n" : "not ok 78\n"); # Q R P=S
-print (fail(substr($a,-2,-2)) ? "ok 79\n" : "not ok 79\n"); # Q=R P=S
-print (fail(substr($a,1,-2)) ? "ok 80\n" : "not ok 81\n"); # R P=S Q
-print (fail(substr($a,1,1)) ? "ok 81\n" : "not ok 81\n"); # P=S Q R
-print (fail(substr($a,1,0)) ? "ok 82\n" : "not ok 82\n"); # P=S Q=R
-print (fail(substr($a,1)) ? "ok 83\n" : "not ok 83\n"); # P=R=S Q
+$b = substr($a,-2,-1) ; # warn # Q R P=S
+ok 89, $w-- == 1 ;
+eval{substr($a,-2,-1) = "" ; }; # Q R P=S
+ok 90, $@ =~ /$FATAL_MSG/;
+$b = substr($a,-2,-2) ; # warn # Q=R P=S
+ok 91, $w-- == 1 ;
+eval{substr($a,-2,-2) = "" ; }; # Q=R P=S
+ok 92, $@ =~ /$FATAL_MSG/;
+
+$b = substr($a, 1,-2) ; # warn # R P=S Q
+ok 93, $w-- == 1 ;
+eval{substr($a, 1,-2) = "" ; }; # R P=S Q
+ok 94, $@ =~ /$FATAL_MSG/;
+
+$b = substr($a, 1, 1) ; # warn # P=S Q R
+ok 95, $w-- == 1 ;
+eval{substr($a, 1, 1) = "" ; }; # P=S Q R
+ok 96, $@ =~ /$FATAL_MSG/;
+
+$b = substr($a, 1, 0) ;# warn # P=S Q=R
+ok 97, $w-- == 1 ;
+eval{substr($a, 1, 0) = "" ; }; # P=S Q=R
+ok 98, $@ =~ /$FATAL_MSG/;
+
+$b = substr($a,1) ; # warning # P=R=S Q
+ok 99, $w-- == 1 ;
+eval{substr($a,1) = "" ; }; # P=R=S Q
+ok 100, $@ =~ /$FATAL_MSG/;
my $a = 'zxcvbnm';
substr($a,2,0) = '';
-print $a eq 'zxcvbnm' ? "ok 84\n" : "not ok 84\n";
+ok 101, $a eq 'zxcvbnm';
substr($a,7,0) = '';
-print $a eq 'zxcvbnm' ? "ok 85\n" : "not ok 85\n";
+ok 102, $a eq 'zxcvbnm';
substr($a,5,0) = '';
-print $a eq 'zxcvbnm' ? "ok 86\n" : "not ok 86\n";
+ok 103, $a eq 'zxcvbnm';
substr($a,0,2) = 'pq';
-print $a eq 'pqcvbnm' ? "ok 87\n" : "not ok 87\n";
+ok 104, $a eq 'pqcvbnm';
substr($a,2,0) = 'r';
-print $a eq 'pqrcvbnm' ? "ok 88\n" : "not ok 88\n";
+ok 105, $a eq 'pqrcvbnm';
substr($a,8,0) = 'asd';
-print $a eq 'pqrcvbnmasd' ? "ok 89\n" : "not ok 89\n";
+ok 106, $a eq 'pqrcvbnmasd';
substr($a,0,2) = 'iop';
-print $a eq 'ioprcvbnmasd' ? "ok 90\n" : "not ok 90\n";
+ok 107, $a eq 'ioprcvbnmasd';
substr($a,0,5) = 'fgh';
-print $a eq 'fghvbnmasd' ? "ok 91\n" : "not ok 91\n";
+ok 108, $a eq 'fghvbnmasd';
substr($a,3,5) = 'jkl';
-print $a eq 'fghjklsd' ? "ok 92\n" : "not ok 92\n";
+ok 109, $a eq 'fghjklsd';
substr($a,3,2) = '1234';
-print $a eq 'fgh1234lsd' ? "ok 93\n" : "not ok 93\n";
+ok 110, $a eq 'fgh1234lsd';
# with lexicals (and in re-entered scopes)
@@ -160,58 +221,50 @@ for (0,1) {
unless ($_) {
$txt = "Foo";
substr($txt, -1) = "X";
- print $txt eq "FoX" ? "ok 94\n" : "not ok 94\n";
+ ok 111, $txt eq "FoX";
}
else {
- local $^W = 0; # because of (spurious?) "uninitialised value"
substr($txt, 0, 1) = "X";
- print $txt eq "X" ? "ok 95\n" : "not ok 95\n";
+ ok 112, $txt eq "X";
}
}
+$w = 0 ;
# coercion of references
{
my $s = [];
substr($s, 0, 1) = 'Foo';
- print substr($s,0,7) eq "FooRRAY" && !($w-=2) ? "ok 96\n" : "not ok 96\n";
+ ok 113, substr($s,0,7) eq "FooRRAY" && !($w-=2);
}
# check no spurious warnings
-print $w ? "not ok 97\n" : "ok 97\n";
+ok 114, $w == 0;
# check new 4 arg replacement syntax
$a = "abcxyz";
$w = 0;
-print "not " unless substr($a, 0, 3, "") eq "abc" && $a eq "xyz";
-print "ok 98\n";
-print "not " unless substr($a, 0, 0, "abc") eq "" && $a eq "abcxyz";
-print "ok 99\n";
-print "not " unless substr($a, 3, -1, "") eq "xy" && $a eq "abcz";
-print "ok 100\n";
-
-print "not " unless substr($a, 3, undef, "xy") eq "" && $a eq "abcxyz"
+ok 115, substr($a, 0, 3, "") eq "abc" && $a eq "xyz";
+ok 116, substr($a, 0, 0, "abc") eq "" && $a eq "abcxyz";
+ok 117, substr($a, 3, -1, "") eq "xy" && $a eq "abcz";
+
+ok 118, substr($a, 3, undef, "xy") eq "" && $a eq "abcxyz"
&& $w == 3;
-print "ok 101\n";
+
$w = 0;
-print "not " unless substr($a, 3, 9999999, "") eq "xyz" && $a eq "abc";
-print "ok 102\n";
-print "not " unless fail(substr($a, -99, 0, ""));
-print "ok 103\n";
-print "not " unless fail(substr($a, 99, 3, ""));
-print "ok 104\n";
+ok 119, substr($a, 3, 9999999, "") eq "xyz" && $a eq "abc";
+eval{substr($a, -99, 0, "") };
+ok 120, $@ =~ /$FATAL_MSG/;
+eval{substr($a, 99, 3, "") };
+ok 121, $@ =~ /$FATAL_MSG/;
substr($a, 0, length($a), "foo");
-print "not " unless $a eq "foo" && !$w;
-print "ok 105\n";
+ok 122, $a eq "foo" && !$w;
# using 4 arg substr as lvalue is a compile time error
eval 'substr($a,0,0,"") = "abc"';
-print "not " unless $@ && $@ =~ /Can't modify substr/ && $a eq "foo";
-print "ok 106\n";
+ok 123, $@ && $@ =~ /Can't modify substr/ && $a eq "foo";
$a = "abcdefgh";
-print "not " unless sub { shift }->(substr($a, 0, 4, "xxxx")) eq 'abcd';
-print "ok 107\n";
-print "not " unless $a eq 'xxxxefgh';
-print "ok 108\n";
+ok 124, sub { shift }->(substr($a, 0, 4, "xxxx")) eq 'abcd';
+ok 125, $a eq 'xxxxefgh';
diff --git a/t/pragma/warn/9enabled b/t/pragma/warn/9enabled
new file mode 100755
index 0000000000..1ecf24a0c0
--- /dev/null
+++ b/t/pragma/warn/9enabled
@@ -0,0 +1,390 @@
+Check warnings::enabled & warnings::warn
+
+__END__
+
+--FILE-- abc.pm
+package abc ;
+use warnings "io" ;
+print "ok1\n" if ! warnings::enabled() ;
+print "ok2\n" if ! warnings::enabled("io") ;
+1;
+--FILE--
+no warnings;
+use abc ;
+EXPECT
+ok1
+ok2
+########
+
+--FILE-- abc.pm
+package abc ;
+no warnings ;
+print "ok1\n" if warnings::enabled() ;
+print "ok2\n" if warnings::enabled("syntax") ;
+1;
+--FILE--
+use warnings 'syntax' ;
+use abc ;
+EXPECT
+ok1
+ok2
+########
+
+--FILE-- abc.pm
+package abc ;
+use warnings 'syntax' ;
+print "ok1\n" if warnings::enabled() ;
+print "ok2\n" if ! warnings::enabled("syntax") ;
+1;
+--FILE--
+use warnings 'io' ;
+use abc ;
+EXPECT
+ok1
+ok2
+########
+
+--FILE-- abc
+no warnings ;
+print "ok1\n" if warnings::enabled() ;
+print "ok2\n" if warnings::enabled("syntax") ;
+1;
+--FILE--
+use warnings 'syntax' ;
+require "abc" ;
+EXPECT
+ok1
+ok2
+########
+
+--FILE-- abc
+use warnings 'syntax' ;
+print "ok1\n" if warnings::enabled ;
+print "ok2\n" if ! warnings::enabled("syntax") ;
+print "ok3\n" if warnings::enabled("io") ;
+1;
+--FILE--
+use warnings 'io' ;
+require "abc" ;
+EXPECT
+ok1
+ok2
+ok3
+########
+
+--FILE-- abc.pm
+package abc ;
+no warnings ;
+sub check {
+ print "ok1\n" if warnings::enabled ;
+ print "ok2\n" if warnings::enabled("syntax") ;
+}
+1;
+--FILE--
+use warnings 'syntax' ;
+use abc ;
+abc::check() ;
+EXPECT
+ok1
+ok2
+########
+
+--FILE-- abc.pm
+package abc ;
+use warnings 'io' ;
+sub check {
+ print "ok1\n" if warnings::enabled ;
+ print "ok2\n" if warnings::enabled("syntax") ;
+ print "ok3\n" if ! warnings::enabled("io") ;
+}
+1;
+--FILE--
+use warnings 'syntax' ;
+use abc ;
+abc::check() ;
+EXPECT
+ok1
+ok2
+ok3
+########
+
+--FILE-- abc
+package abc ;
+no warnings ;
+sub check {
+ print "ok1\n" if warnings::enabled ;
+ print "ok2\n" if warnings::enabled("syntax") ;
+}
+1;
+--FILE--
+use warnings 'syntax' ;
+require "abc" ;
+abc::check() ;
+EXPECT
+ok1
+ok2
+########
+
+--FILE-- abc
+package abc ;
+use warnings 'io' ;
+sub check {
+ print "ok1\n" if warnings::enabled ;
+ print "ok2\n" if warnings::enabled("syntax") ;
+ print "ok3\n" if ! warnings::enabled("io") ;
+}
+1;
+--FILE--
+use warnings 'syntax' ;
+require "abc" ;
+abc::check() ;
+EXPECT
+ok1
+ok2
+ok3
+########
+
+--FILE-- abc.pm
+package abc ;
+use warnings "io" ;
+print "ok1\n" if ! warnings::enabled() ;
+print "ok2\n" if ! warnings::enabled("io") ;
+1;
+--FILE-- def.pm
+no warnings;
+use abc ;
+1;
+--FILE--
+use warnings;
+use def ;
+EXPECT
+ok1
+ok2
+########
+
+--FILE-- abc.pm
+package abc ;
+no warnings ;
+print "ok1\n" if warnings::enabled() ;
+print "ok2\n" if warnings::enabled("syntax") ;
+print "ok3\n" if !warnings::enabled("io") ;
+1;
+--FILE-- def.pm
+use warnings 'syntax' ;
+print "ok4\n" if warnings::enabled() ;
+print "ok5\n" if warnings::enabled("io") ;
+use abc ;
+1;
+--FILE--
+use warnings 'io' ;
+use def ;
+EXPECT
+ok1
+ok2
+ok3
+ok4
+ok5
+########
+
+--FILE-- abc.pm
+package abc ;
+no warnings ;
+sub check {
+ print "ok1\n" if warnings::enabled ;
+ print "ok2\n" if warnings::enabled("syntax") ;
+}
+1;
+--FILE--
+use warnings 'syntax' ;
+use abc ;
+eval { abc::check() ; };
+print $@ ;
+EXPECT
+ok1
+ok2
+########
+
+--FILE-- abc.pm
+package abc ;
+use warnings 'io' ;
+sub check {
+ print "ok1\n" if warnings::enabled ;
+ print "ok2\n" if warnings::enabled("syntax") ;
+ print "ok3\n" if ! warnings::enabled("io") ;
+}
+1;
+--FILE--
+use warnings 'syntax' ;
+use abc ;
+eval { abc::check() ; } ;
+print $@ ;
+EXPECT
+ok1
+ok2
+ok3
+########
+
+--FILE-- abc
+package abc ;
+no warnings ;
+sub check {
+ print "ok1\n" if warnings::enabled ;
+ print "ok2\n" if warnings::enabled("syntax") ;
+}
+1;
+--FILE--
+use warnings 'syntax' ;
+require "abc" ;
+eval { abc::check() ; } ;
+print $@ ;
+EXPECT
+ok1
+ok2
+########
+
+--FILE-- abc
+package abc ;
+use warnings 'io' ;
+sub check {
+ print "ok1\n" if warnings::enabled ;
+ print "ok2\n" if warnings::enabled("syntax") ;
+ print "ok3\n" if warnings::enabled("io") ;
+}
+1;
+--FILE--
+use warnings 'syntax' ;
+require "abc" ;
+eval { use warnings 'io' ; abc::check() ; };
+abc::check() ;
+print $@ ;
+EXPECT
+ok1
+ok2
+ok3
+ok1
+ok2
+########
+
+--FILE-- abc.pm
+package abc ;
+use warnings 'io' ;
+sub check {
+ print "ok1\n" if warnings::enabled ;
+ print "ok2\n" if warnings::enabled("syntax") ;
+ print "ok3\n" if ! warnings::enabled("io") ;
+}
+1;
+--FILE--
+use warnings 'syntax' ;
+use abc ;
+sub fred { abc::check() }
+fred() ;
+EXPECT
+ok1
+ok2
+ok3
+########
+
+--FILE-- abc.pm
+package abc ;
+use warnings 'io' ;
+sub check {
+ print "ok1\n" if ! warnings::enabled ;
+}
+1;
+--FILE--
+use warnings 'syntax' ;
+use abc ;
+sub fred { no warnings ; abc::check() }
+fred() ;
+EXPECT
+ok1
+########
+
+--FILE-- abc.pm
+package abc ;
+use warnings 'misc' ;
+sub check {
+ print "ok1\n" if warnings::enabled ;
+ print "ok2\n" if warnings::enabled("syntax") ;
+ print "ok3\n" if warnings::enabled("io") ;
+ print "ok4\n" if ! warnings::enabled("misc") ;
+}
+1;
+--FILE--
+use warnings 'syntax' ;
+use abc ;
+sub fred { use warnings 'io' ; abc::check() }
+fred() ;
+EXPECT
+ok1
+ok2
+ok3
+ok4
+########
+
+# check warnings::warn
+use warnings ;
+eval { warnings::warn() } ;
+print $@ ;
+eval { warnings::warn("fred") } ;
+print $@ ;
+EXPECT
+Usage: warnings::warn('category', 'message') at - line 4
+Usage: warnings::warn('category', 'message') at - line 6
+########
+
+--FILE-- abc.pm
+package abc ;
+use warnings 'misc' ;
+sub check { warnings::warn("io", "hello") }
+1;
+--FILE--
+use warnings "io" ;
+use abc;
+abc::check() ;
+EXPECT
+hello at - line 3
+########
+
+--FILE-- abc.pm
+package abc ;
+use warnings 'misc' ;
+sub check { warnings::warn("misc", "hello") }
+1;
+--FILE--
+use warnings "io" ;
+use abc;
+abc::check() ;
+EXPECT
+hello at - line 3
+########
+
+--FILE-- abc.pm
+package abc ;
+use warnings 'misc' ;
+sub check { warnings::warn("io", "hello") }
+1;
+--FILE--
+use warnings qw( FATAL deprecated ) ;
+use abc;
+eval { abc::check() ; } ;
+print "[[$@]]\n";
+EXPECT
+hello at - line 3
+[[]]
+########
+
+--FILE-- abc.pm
+package abc ;
+use warnings 'misc' ;
+sub check { warnings::warn("io", "hello") }
+1;
+--FILE--
+use warnings qw( FATAL io ) ;
+use abc;
+eval { abc::check() ; } ;
+print "[[$@]]\n";
+EXPECT
+[[hello at - line 3
+]]
diff --git a/t/pragma/warn/op b/t/pragma/warn/op
index 9fd418e5bc..d70a333bbc 100644
--- a/t/pragma/warn/op
+++ b/t/pragma/warn/op
@@ -59,7 +59,7 @@
local $a, $b = (1,2);
Bareword found in conditional at -e line 1.
- use warnings 'syntax'; my $x = print(ABC || 1);
+ use warnings 'bareword'; my $x = print(ABC || 1);
Value of %s may be \"0\"; use \"defined\"
$x = 1 if $x = <FH> ;
@@ -117,16 +117,16 @@
__END__
# op.c
-use warnings 'unsafe' ;
+use warnings 'misc' ;
my $x ;
my $x ;
-no warnings 'unsafe' ;
+no warnings 'misc' ;
my $x ;
EXPECT
"my" variable $x masks earlier declaration in same scope at - line 4.
########
# op.c
-use warnings 'unsafe' ;
+use warnings 'closure' ;
sub x {
my $x;
sub y {
@@ -137,7 +137,7 @@ EXPECT
Variable "$x" will not stay shared at - line 7.
########
# op.c
-no warnings 'unsafe' ;
+no warnings 'closure' ;
sub x {
my $x;
sub y {
@@ -148,7 +148,7 @@ EXPECT
########
# op.c
-use warnings 'unsafe' ;
+use warnings 'closure' ;
sub x {
my $x;
sub y {
@@ -159,7 +159,7 @@ EXPECT
Variable "$x" may be unavailable at - line 6.
########
# op.c
-no warnings 'unsafe' ;
+no warnings 'closure' ;
sub x {
my $x;
sub y {
@@ -559,7 +559,7 @@ Useless use of a constant in void context at - line 4.
########
# op.c
BEGIN{ $ENV{PERL_DESTRUCT_LEVEL} = 0 unless $ENV{PERL_DESTRUCT_LEVEL} > 3; } # known scalar leak
-use warnings 'unsafe' ;
+use warnings 'misc' ;
my $a ; my @a = () ; my %a = () ; my $b = \@a ; my $c = \%a ;
@a =~ /abc/ ;
@a =~ s/a/b/ ;
@@ -574,7 +574,7 @@ my $a ; my @a = () ; my %a = () ; my $b = \@a ; my $c = \%a ;
%$c =~ s/a/b/ ;
%$c =~ tr/a/b/ ;
{
-no warnings 'unsafe' ;
+no warnings 'misc' ;
my $a ; my @a = () ; my %a = () ; my $b = \@a ; my $c = \%a ;
@a =~ /abc/ ;
@a =~ s/a/b/ ;
@@ -622,9 +622,9 @@ EXPECT
Parentheses missing around "local" list at - line 3.
########
# op.c
-use warnings 'syntax' ;
+use warnings 'bareword' ;
print (ABC || 1) ;
-no warnings 'syntax' ;
+no warnings 'bareword' ;
print (ABC || 1) ;
EXPECT
Bareword found in conditional at - line 3.
@@ -633,54 +633,54 @@ Bareword found in conditional at - line 3.
--FILE--
# op.c
-use warnings 'unsafe' ;
+use warnings 'misc' ;
open FH, "<abc" ;
$x = 1 if $x = <FH> ;
-no warnings 'unsafe' ;
+no warnings 'misc' ;
$x = 1 if $x = <FH> ;
EXPECT
Value of <HANDLE> construct can be "0"; test with defined() at - line 4.
########
# op.c
-use warnings 'unsafe' ;
+use warnings 'misc' ;
opendir FH, "." ;
$x = 1 if $x = readdir FH ;
-no warnings 'unsafe' ;
+no warnings 'misc' ;
$x = 1 if $x = readdir FH ;
closedir FH ;
EXPECT
Value of readdir() operator can be "0"; test with defined() at - line 4.
########
# op.c
-use warnings 'unsafe' ;
+use warnings 'misc' ;
$x = 1 if $x = <*> ;
-no warnings 'unsafe' ;
+no warnings 'misc' ;
$x = 1 if $x = <*> ;
EXPECT
Value of glob construct can be "0"; test with defined() at - line 3.
########
# op.c
-use warnings 'unsafe' ;
+use warnings 'misc' ;
%a = (1,2,3,4) ;
$x = 1 if $x = each %a ;
-no warnings 'unsafe' ;
+no warnings 'misc' ;
$x = 1 if $x = each %a ;
EXPECT
Value of each() operator can be "0"; test with defined() at - line 4.
########
# op.c
-use warnings 'unsafe' ;
+use warnings 'misc' ;
$x = 1 while $x = <*> and 0 ;
-no warnings 'unsafe' ;
+no warnings 'misc' ;
$x = 1 while $x = <*> and 0 ;
EXPECT
Value of glob construct can be "0"; test with defined() at - line 3.
########
# op.c
-use warnings 'unsafe' ;
+use warnings 'misc' ;
opendir FH, "." ;
$x = 1 while $x = readdir FH and 0 ;
-no warnings 'unsafe' ;
+no warnings 'misc' ;
$x = 1 while $x = readdir FH and 0 ;
closedir FH ;
EXPECT
@@ -717,17 +717,17 @@ EXPECT
Format FRED redefined at - line 5.
########
# op.c
-use warnings 'syntax' ;
+use warnings 'deprecated' ;
push FRED;
-no warnings 'syntax' ;
+no warnings 'deprecated' ;
push FRED;
EXPECT
Array @FRED missing the @ in argument 1 of push() at - line 3.
########
# op.c
-use warnings 'syntax' ;
+use warnings 'deprecated' ;
@a = keys FRED ;
-no warnings 'syntax' ;
+no warnings 'deprecated' ;
@a = keys FRED ;
EXPECT
Hash %FRED missing the % in argument 1 of keys() at - line 3.
@@ -779,10 +779,10 @@ $^W = 0 ;
sub fred() ;
sub fred($) {}
{
- no warnings 'unsafe' ;
+ no warnings 'prototype' ;
sub Fred() ;
sub Fred($) {}
- use warnings 'unsafe' ;
+ use warnings 'prototype' ;
sub freD() ;
sub freD($) {}
}
@@ -800,10 +800,10 @@ EXPECT
/---/ should probably be written as "---" at - line 3.
########
# op.c [Perl_peep]
-use warnings 'unsafe' ;
+use warnings 'prototype' ;
fred() ;
sub fred ($$) {}
-no warnings 'unsafe' ;
+no warnings 'prototype' ;
joe() ;
sub joe ($$) {}
EXPECT
diff --git a/t/pragma/warn/pp b/t/pragma/warn/pp
index 4c70fd5d6f..b392029767 100644
--- a/t/pragma/warn/pp
+++ b/t/pragma/warn/pp
@@ -1,7 +1,7 @@
pp.c TODO
substr outside of string
- $a = "ab" ; $a = substr($a, 4,5)
+ $a = "ab" ; $b = substr($a, 4,5) ;
Attempt to use reference as lvalue in substr
$a = "ab" ; $b = \$a ; substr($b, 1,1) = $b
@@ -37,10 +37,10 @@ __END__
# pp.c
use warnings 'substr' ;
$a = "ab" ;
-$a = substr($a, 4,5);
+$b = substr($a, 4,5) ;
no warnings 'substr' ;
$a = "ab" ;
-$a = substr($a, 4,5);
+$b = substr($a, 4,5) ;
EXPECT
substr outside of string at - line 4.
########
@@ -61,23 +61,25 @@ EXPECT
########
# pp.c
-use warnings 'unsafe' ;
+use warnings 'misc' ;
my $a = { 1,2,3};
-no warnings 'unsafe' ;
+no warnings 'misc' ;
my $b = { 1,2,3};
EXPECT
Odd number of elements in hash assignment at - line 3.
########
# pp.c
-use warnings 'unsafe' ;
+use warnings 'pack' ;
+use warnings 'unpack' ;
my @a = unpack ("A,A", "22") ;
my $a = pack ("A,A", 1,2) ;
-no warnings 'unsafe' ;
+no warnings 'pack' ;
+no warnings 'unpack' ;
my @b = unpack ("A,A", "22") ;
my $b = pack ("A,A", 1,2) ;
EXPECT
-Invalid type in unpack: ',' at - line 3.
-Invalid type in pack: ',' at - line 4.
+Invalid type in unpack: ',' at - line 4.
+Invalid type in pack: ',' at - line 5.
########
# pp.c
use warnings 'uninitialized' ;
@@ -89,18 +91,18 @@ EXPECT
Use of uninitialized value in scalar dereference at - line 4.
########
# pp.c
-use warnings 'unsafe' ;
+use warnings 'pack' ;
sub foo { my $a = "a"; return $a . $a++ . $a++ }
my $a = pack("p", &foo) ;
-no warnings 'unsafe' ;
+no warnings 'pack' ;
my $b = pack("p", &foo) ;
EXPECT
Attempt to pack pointer to temporary value at - line 4.
########
# pp.c
-use warnings 'unsafe' ;
+use warnings 'misc' ;
bless \[], "" ;
-no warnings 'unsafe' ;
+no warnings 'misc' ;
bless \[], "" ;
EXPECT
Explicit blessing to '' (assuming package main) at - line 3.
diff --git a/t/pragma/warn/pp_ctl b/t/pragma/warn/pp_ctl
index f61da1a8e1..0deccd35e2 100644
--- a/t/pragma/warn/pp_ctl
+++ b/t/pragma/warn/pp_ctl
@@ -81,14 +81,14 @@ EXPECT
1
########
# pp_ctl.c
-use warnings 'unsafe' ;
+use warnings 'exiting' ;
$_ = "abc" ;
while ($i ++ == 0)
{
s/ab/last/e ;
}
-no warnings 'unsafe' ;
+no warnings 'exiting' ;
while ($i ++ == 0)
{
s/ab/last/e ;
@@ -97,10 +97,10 @@ EXPECT
Exiting substitution via last at - line 7.
########
# pp_ctl.c
-use warnings 'unsafe' ;
+use warnings 'exiting' ;
sub fred { last }
{ fred() }
-no warnings 'unsafe' ;
+no warnings 'exiting' ;
sub joe { last }
{ joe() }
EXPECT
@@ -108,35 +108,35 @@ Exiting subroutine via last at - line 3.
########
# pp_ctl.c
{
- eval "use warnings 'unsafe' ; last;"
+ eval "use warnings 'exiting' ; last;"
}
print STDERR $@ ;
{
- eval "no warnings 'unsafe' ;last;"
+ eval "no warnings 'exiting' ;last;"
}
print STDERR $@ ;
EXPECT
Exiting eval via last at (eval 1) line 1.
########
# pp_ctl.c
-use warnings 'unsafe' ;
+use warnings 'exiting' ;
@a = (1,2) ;
@b = sort { last } @a ;
-no warnings 'unsafe' ;
+no warnings 'exiting' ;
@b = sort { last } @a ;
EXPECT
Exiting pseudo-block via last at - line 4.
Can't "last" outside a loop block at - line 4.
########
# pp_ctl.c
-use warnings 'unsafe' ;
+use warnings 'exiting' ;
$_ = "abc" ;
fred:
while ($i ++ == 0)
{
s/ab/last fred/e ;
}
-no warnings 'unsafe' ;
+no warnings 'exiting' ;
while ($i ++ == 0)
{
s/ab/last fred/e ;
@@ -145,10 +145,10 @@ EXPECT
Exiting substitution via last at - line 7.
########
# pp_ctl.c
-use warnings 'unsafe' ;
+use warnings 'exiting' ;
sub fred { last joe }
joe: { fred() }
-no warnings 'unsafe' ;
+no warnings 'exiting' ;
sub Fred { last Joe }
Joe: { Fred() }
EXPECT
@@ -156,19 +156,19 @@ Exiting subroutine via last at - line 3.
########
# pp_ctl.c
joe:
-{ eval "use warnings 'unsafe' ; last joe;" }
+{ eval "use warnings 'exiting' ; last joe;" }
print STDERR $@ ;
Joe:
-{ eval "no warnings 'unsafe' ; last Joe;" }
+{ eval "no warnings 'exiting' ; last Joe;" }
print STDERR $@ ;
EXPECT
Exiting eval via last at (eval 1) line 1.
########
# pp_ctl.c
-use warnings 'unsafe' ;
+use warnings 'exiting' ;
@a = (1,2) ;
fred: @b = sort { last fred } @a ;
-no warnings 'unsafe' ;
+no warnings 'exiting' ;
Fred: @b = sort { last Fred } @a ;
EXPECT
Exiting pseudo-block via last at - line 4.
@@ -198,7 +198,7 @@ fred()
EXPECT
########
# pp_ctl.c
-use warnings 'unsafe' ;
+use warnings 'misc' ;
package Foo;
DESTROY { die "@{$_[0]} foo bar" }
{ bless ['A'], 'Foo' for 1..10 }
@@ -208,7 +208,7 @@ EXPECT
(in cleanup) B foo bar at - line 4.
########
# pp_ctl.c
-no warnings 'unsafe' ;
+no warnings 'misc' ;
package Foo;
DESTROY { die "@{$_[0]} foo bar" }
{ bless ['A'], 'Foo' for 1..10 }
diff --git a/t/pragma/warn/pp_hot b/t/pragma/warn/pp_hot
index 312f7da9b2..0cbbc439ad 100644
--- a/t/pragma/warn/pp_hot
+++ b/t/pragma/warn/pp_hot
@@ -114,17 +114,17 @@ EXPECT
Use of uninitialized value in hash dereference at - line 4.
########
# pp_hot.c [pp_aassign]
-use warnings 'unsafe' ;
+use warnings 'misc' ;
my %X ; %X = (1,2,3) ;
-no warnings 'unsafe' ;
+no warnings 'misc' ;
my %Y ; %Y = (1,2,3) ;
EXPECT
Odd number of elements in hash assignment at - line 3.
########
# pp_hot.c [pp_aassign]
-use warnings 'unsafe' ;
+use warnings 'misc' ;
my %X ; %X = [1 .. 3] ;
-no warnings 'unsafe' ;
+no warnings 'misc' ;
my %Y ; %Y = [1 .. 3] ;
EXPECT
Reference found where even-sized list expected at - line 3.
@@ -205,7 +205,7 @@ $b = sub
EXPECT
########
# pp_hot.c [pp_concat]
-use warnings 'misc';
+use warnings 'y2k';
use Config;
BEGIN {
unless ($Config{ccflags} =~ /Y2KWARN/) {
@@ -219,7 +219,7 @@ $x = "19$yy\n";
$x = "19" . $yy . "\n";
$x = "319$yy\n";
$x = "319" . $yy . "\n";
-no warnings 'misc';
+no warnings 'y2k';
$x = "19$yy\n";
$x = "19" . $yy . "\n";
EXPECT
diff --git a/t/pragma/warn/regcomp b/t/pragma/warn/regcomp
index bb208db6bd..7d485f2efd 100644
--- a/t/pragma/warn/regcomp
+++ b/t/pragma/warn/regcomp
@@ -7,7 +7,7 @@
$a = "ABC123" ; $a =~ /(?=a)*/'
/%.127s/: Unrecognized escape \\%c passed through" [S_regatom]
- /\m/
+ $x = '\m' ; /$x/
Character class syntax [. .] is reserved for future extensions [S_regpposixcc]
@@ -25,33 +25,34 @@
__END__
# regcomp.c [S_regpiece]
-use warnings 'unsafe' ;
+use warnings 'regexp' ;
my $a = "ABC123" ;
$a =~ /(?=a)*/ ;
-no warnings 'unsafe' ;
+no warnings 'regexp' ;
$a =~ /(?=a)*/ ;
EXPECT
(?=a)* matches null string many times at - line 4.
########
# regcomp.c [S_study_chunk]
-use warnings 'unsafe' ;
+use warnings 'regexp' ;
$_ = "" ;
/(?=a)?/;
-no warnings 'unsafe' ;
+no warnings 'regexp' ;
/(?=a)?/;
EXPECT
Strange *+?{} on zero-length expression at - line 4.
########
# regcomp.c [S_regatom]
-use warnings 'unsafe' ;
-$a =~ /a\mb\b/ ;
-no warnings 'unsafe' ;
-$a =~ /a\mb\b/ ;
+$x = '\m' ;
+use warnings 'regexp' ;
+$a =~ /a$x/ ;
+no warnings 'regexp' ;
+$a =~ /a$x/ ;
EXPECT
-Unrecognized escape \m passed through at - line 3.
+/a\m/: Unrecognized escape \m passed through at - line 4.
########
# regcomp.c [S_regpposixcc S_checkposixcc]
-use warnings 'unsafe' ;
+use warnings 'regexp' ;
$_ = "" ;
/[:alpha:]/;
/[.bar.]/;
@@ -60,7 +61,7 @@ $_ = "" ;
/[[.foo.]]/;
/[[=bar=]]/;
/[:zog:]/;
-no warnings 'unsafe' ;
+no warnings 'regexp' ;
/[:alpha:]/;
/[.foo.]/;
/[=bar=]/;
@@ -83,7 +84,7 @@ Character class [:zog:] unknown at - line 20.
########
# regcomp.c [S_regclass]
$_ = "";
-use warnings 'unsafe' ;
+use warnings 'regexp' ;
/[a-b]/;
/[a-\d]/;
/[\d-b]/;
@@ -93,7 +94,7 @@ use warnings 'unsafe' ;
/[[:digit:]-b]/;
/[[:alpha:]-[:digit:]]/;
/[[:digit:]-[:alpha:]]/;
-no warnings 'unsafe' ;
+no warnings 'regexp' ;
/[a-b]/;
/[a-\d]/;
/[\d-b]/;
@@ -122,7 +123,7 @@ BEGIN {
}
use utf8;
$_ = "";
-use warnings 'unsafe' ;
+use warnings 'regexp' ;
/[a-b]/;
/[a-\d]/;
/[\d-b]/;
@@ -132,7 +133,7 @@ use warnings 'unsafe' ;
/[[:digit:]-b]/;
/[[:alpha:]-[:digit:]]/;
/[[:digit:]-[:alpha:]]/;
-no warnings 'unsafe' ;
+no warnings 'regexp' ;
/[a-b]/;
/[a-\d]/;
/[\d-b]/;
@@ -153,9 +154,9 @@ EXPECT
/[[:digit:]-[:alpha:]]/: false [] range "[:digit:]-" in regexp at - line 19.
########
# regcomp.c [S_regclass S_regclassutf8]
-use warnings 'unsafe' ;
+use warnings 'regexp' ;
$a =~ /[a\zb]/ ;
-no warnings 'unsafe' ;
+no warnings 'regexp' ;
$a =~ /[a\zb]/ ;
EXPECT
/[a\zb]/: Unrecognized escape \z in character class passed through at - line 3.
diff --git a/t/pragma/warn/regexec b/t/pragma/warn/regexec
index b9ba790832..73696dfb1d 100644
--- a/t/pragma/warn/regexec
+++ b/t/pragma/warn/regexec
@@ -16,7 +16,7 @@
__END__
# regexec.c
print("SKIPPED\n# most systems run into stacksize limits\n"),exit;
-use warnings 'unsafe' ;
+use warnings 'regexp' ;
$SIG{__WARN__} = sub{local ($m) = shift;
$m =~ s/\(\d+\)/(*MASKED*)/;
print STDERR $m};
@@ -42,7 +42,7 @@ Complex regular subexpression recursion limit (*MASKED*) exceeded at - line 9.
########
# regexec.c
print("SKIPPED\n# most systems run into stacksize limits\n"),exit;
-no warnings 'unsafe' ;
+no warnings 'regexp' ;
$SIG{__WARN__} = sub{local ($m) = shift;
$m =~ s/\(\d+\)/(*MASKED*)/;
print STDERR $m};
@@ -68,7 +68,7 @@ EXPECT
########
# regexec.c
print("SKIPPED\n# most systems run into stacksize limits\n"),exit;
-use warnings 'unsafe' ;
+use warnings 'regexp' ;
$SIG{__WARN__} = sub{local ($m) = shift;
$m =~ s/\(\d+\)/(*MASKED*)/;
print STDERR $m};
@@ -94,7 +94,7 @@ Complex regular subexpression recursion limit (*MASKED*) exceeded at - line 9.
########
# regexec.c
print("SKIPPED\n# most systems run into stacksize limits\n"),exit;
-no warnings 'unsafe' ;
+no warnings 'regexp' ;
$SIG{__WARN__} = sub{local ($m) = shift;
$m =~ s/\(\d+\)/(*MASKED*)/;
print STDERR $m};
diff --git a/t/pragma/warn/sv b/t/pragma/warn/sv
index cdec48e2c2..9a2428e0cb 100644
--- a/t/pragma/warn/sv
+++ b/t/pragma/warn/sv
@@ -261,9 +261,9 @@ Invalid conversion in printf: end of string at - line 6.
Invalid conversion in printf: "%\002" at - line 8.
########
# sv.c
-use warnings 'unsafe' ;
+use warnings 'misc' ;
*a = undef ;
-no warnings 'unsafe' ;
+no warnings 'misc' ;
*b = undef ;
EXPECT
Undefined value assigned to typeglob at - line 3.
@@ -288,7 +288,7 @@ EXPECT
\xff will produce malformed UTF-8 character; use \x{ff} for that at - line 12.
########
# sv.c
-use warnings 'misc';
+use warnings 'y2k';
use Config;
BEGIN {
unless ($Config{ccflags} =~ /Y2KWARN/) {
@@ -305,7 +305,7 @@ $x = printf " 19%02d\n", 78;
$x = sprintf "19%02d\n", 78;
$x = printf "319%02d\n", $yy;
$x = sprintf "319%02d\n", $yy;
-no warnings 'misc';
+no warnings 'y2k';
$x = printf "19%02d\n", $yy;
$x = sprintf "19%02d\n", $yy;
$x = printf "19%02d\n", 78;
diff --git a/t/pragma/warn/toke b/t/pragma/warn/toke
index 48f97dd10c..271ef6365c 100644
--- a/t/pragma/warn/toke
+++ b/t/pragma/warn/toke
@@ -52,7 +52,7 @@ toke.c AOK
warn(warn_reserved
$a = abc;
- chmod: mode argument is missing initial 0
+ chmod() mode argument is missing initial 0
chmod 3;
Possible attempt to separate words with commas
@@ -300,33 +300,33 @@ EXPECT
Unquoted string "abc" may clash with future reserved word at - line 3.
########
# toke.c
-use warnings 'octal' ;
+use warnings 'chmod' ;
chmod 3;
-no warnings 'octal' ;
+no warnings 'chmod' ;
chmod 3;
EXPECT
-chmod: mode argument is missing initial 0 at - line 3.
+chmod() mode argument is missing initial 0 at - line 3.
########
# toke.c
-use warnings 'syntax' ;
+use warnings 'qw' ;
@a = qw(a, b, c) ;
-no warnings 'syntax' ;
+no warnings 'qw' ;
@a = qw(a, b, c) ;
EXPECT
Possible attempt to separate words with commas at - line 3.
########
# toke.c
-use warnings 'syntax' ;
+use warnings 'qw' ;
@a = qw(a b #) ;
-no warnings 'syntax' ;
+no warnings 'qw' ;
@a = qw(a b #) ;
EXPECT
Possible attempt to put comments in qw() list at - line 3.
########
# toke.c
-use warnings 'octal' ;
+use warnings 'umask' ;
umask 3;
-no warnings 'octal' ;
+no warnings 'umask' ;
umask 3;
EXPECT
umask: argument is missing initial 0 at - line 3.
@@ -417,10 +417,10 @@ Misplaced _ in number at - line 4.
Misplaced _ in number at - line 4.
########
# toke.c
-use warnings 'unsafe' ;
+use warnings 'bareword' ;
#line 25 "bar"
$a = FRED:: ;
-no warnings 'unsafe' ;
+no warnings 'bareword' ;
#line 25 "bar"
$a = FRED:: ;
EXPECT
@@ -512,9 +512,9 @@ Precedence problem: open FOO should be open(FOO) at - line 2.
$^W = 0 ;
open FOO || time;
{
- no warnings 'ambiguous' ;
+ no warnings 'precedence' ;
open FOO || time;
- use warnings 'ambiguous' ;
+ use warnings 'precedence' ;
open FOO || time;
}
open FOO || time;
@@ -542,9 +542,9 @@ Operator or semicolon missing before *foo at - line 10.
Ambiguous use of * resolved as operator * at - line 10.
########
# toke.c
-use warnings 'unsafe' ;
+use warnings 'misc' ;
my $a = "\m" ;
-no warnings 'unsafe' ;
+no warnings 'misc' ;
$a = "\m" ;
EXPECT
Unrecognized escape \m passed through at - line 3.