memcpy has n o in it, as pinted ut by Sarathy.
[p5sagit/p5-mst-13.2.git] / t / pragma / warn / pp_hot
index 6bd3151..2759057 100644 (file)
@@ -9,7 +9,7 @@
   Filehandle %s opened only for output         [pp_print]
     print <STDOUT> ;
 
-  print on closed filehandle %s                        [pp_print]
+  print() on closed filehandle %s              [pp_print]
     close STDIN ; print STDIN "abc" ;
 
   uninitialized                                        [pp_rv2av]
 
   glob failed (can't start child: %s)          [Perl_do_readline] <<TODO
 
-  Read on closed filehandle %s                 [Perl_do_readline]
+  readline() on closed filehandle %s           [Perl_do_readline]
     close STDIN ; $a = <STDIN>;
 
   glob failed (child exited with status %d%s)  [Perl_do_readline] <<TODO
 
   Deep recursion on subroutine \"%s\"          [Perl_sub_crush_depth]
-     sub fred { fred() if $a++ < 200} fred()
+    sub fred { fred() if $a++ < 200} fred()
 
   Deep recursion on anonymous subroutine       [Perl_sub_crush_depth]
-     $a = sub { &$a if $a++ < 200} &$a
+    $a = sub { &$a if $a++ < 200} &$a
 
+  Possible Y2K bug: about to append an integer to '19' [pp_concat]
+    $x     = "19$yy\n";
 
 __END__
 # pp_hot.c [pp_print]
@@ -61,10 +63,9 @@ open(FOO, ">&STDOUT") and print <FOO>;
 print getc(STDERR);
 print getc(FOO);
 ####################################################################
-# The next test is known to fail on some systems (Linux/BSD+glibc, #
-# NeXT among others.  glibc should be fixed in the next version,   #
-# but it appears other platforms have little hope.  We skip it for #
-# now (on the grounds that it is "just" a warning).                #
+# The next test is known to fail on some systems (Linux+old glibc, #
+# old *BSDs, and NeXT, among others.                               #
+# We skip it for now (on the grounds that it is "just" a warning). #
 ####################################################################
 #read(FOO,$_,1);
 no warnings 'io' ;
@@ -81,10 +82,17 @@ Filehandle main::FOO opened only for output at - line 8.
 use warnings 'closed' ;
 close STDIN ;
 print STDIN "anc";
+opendir STDIN, ".";
+print STDIN "anc";
+closedir STDIN;
 no warnings 'closed' ;
 print STDIN "anc";
+opendir STDIN, ".";
+print STDIN "anc";
 EXPECT
-print on closed filehandle main::STDIN at - line 4.
+print() on closed filehandle main::STDIN at - line 4.
+print() on closed filehandle main::STDIN at - line 6.
+       (Are you trying to call print() on dirhandle main::STDIN?)
 ########
 # pp_hot.c [pp_rv2av]
 use warnings 'uninitialized' ;
@@ -93,7 +101,7 @@ my @b = @$a;
 no warnings 'uninitialized' ;
 my @c = @$a;
 EXPECT
-Use of uninitialized value at - line 4.
+Use of uninitialized value in array dereference at - line 4.
 ########
 # pp_hot.c [pp_rv2hv]
 use warnings 'uninitialized' ;
@@ -102,31 +110,36 @@ my %b = %$a;
 no warnings 'uninitialized' ;
 my %c = %$a;
 EXPECT
-Use of uninitialized value at - line 4.
+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.
 ########
 # pp_hot.c [Perl_do_readline]
 use warnings 'closed' ;
-close STDIN ; $a = <STDIN> ;
+close STDIN        ; $a = <STDIN> ;
+opendir STDIN, "." ; $a = <STDIN> ;
+closedir STDIN;
 no warnings 'closed' ;
+opendir STDIN, "." ; $a = <STDIN> ;
 $a = <STDIN> ;
 EXPECT
-Read on closed filehandle main::STDIN at - line 3.
+readline() on closed filehandle main::STDIN at - line 3.
+readline() on closed filehandle main::STDIN at - line 4.
+       (Are you trying to call readline() on dirhandle main::STDIN?)
 ########
 # pp_hot.c [Perl_do_readline]
 use warnings 'io' ;
@@ -189,4 +202,25 @@ $b = sub
 
 &$b ;
 EXPECT
-
+########
+# pp_hot.c [pp_concat]
+use warnings 'y2k';
+use Config;
+BEGIN {
+    unless ($Config{ccflags} =~ /Y2KWARN/) {
+       print "SKIPPED\n# perl not built with -DPERL_Y2KWARN";
+       exit 0;
+    }
+}
+my $x;
+my $yy = 78;
+$x     = "19$yy\n";
+$x     = "19" . $yy . "\n";
+$x     = "319$yy\n";
+$x     = "319" . $yy . "\n";
+no warnings 'y2k';
+$x     = "19$yy\n";
+$x     = "19" . $yy . "\n";
+EXPECT
+Possible Y2K bug: about to append an integer to '19' at - line 12.
+Possible Y2K bug: about to append an integer to '19' at - line 13.