Remove the "Newline in left-justified string" warning.
[p5sagit/p5-mst-13.2.git] / t / lib / warnings / pad
index 71f683e..f0dce60 100644 (file)
@@ -41,6 +41,45 @@ EXPECT
 "my" variable $y masks earlier declaration in same statement at - line 5.
 ########
 # pad.c
+use warnings 'misc' ;
+our $x ;
+our $x ;
+our $y = our $y ;
+no warnings 'misc' ;
+our $x ;
+our $y ;
+EXPECT
+"our" variable $x masks earlier declaration in same scope at - line 4.
+"our" variable $y masks earlier declaration in same statement at - line 5.
+########
+# pad.c
+use warnings 'misc' ;
+our $x ;
+my $x ;
+our $y = my $y ;
+no warnings 'misc' ;
+our $z ;
+my $z ;
+our $t = my $t ;
+EXPECT
+"my" variable $x masks earlier declaration in same scope at - line 4.
+"my" variable $y masks earlier declaration in same statement at - line 5.
+########
+# pad.c
+# TODO not implemented yet
+use warnings 'misc' ;
+my $x ;
+our $x ;
+my $y = our $y ;
+no warnings 'misc' ;
+my $z ;
+our $z ;
+my $t = our $t ;
+EXPECT
+"our" variable $x masks earlier declaration in same scope at - line 5.
+"our" variable $y masks earlier declaration in same statement at - line 6.
+########
+# pad.c
 use warnings 'closure' ;
 sub x {
       my $x;
@@ -149,6 +188,25 @@ f()->();
 EXPECT
 Variable "$x" is not available at (eval 1) line 2.
 ########
+use warnings 'closure' ;
+{
+    my $x = 1;
+    $y = \$x; # force abandonment rather than clear-in-place at scope exit
+    sub f2 { eval '$x' }
+}
+f2();
+EXPECT
+Variable "$x" is not available at (eval 1) line 2.
+########
+use warnings 'closure' ;
+for my $x (1,2,3) {
+    sub f { eval '$x' }
+    f();
+}
+f();
+EXPECT
+Variable "$x" is not available at (eval 4) line 2.
+########
 # pad.c
 no warnings 'closure' ;
 sub x {
@@ -168,3 +226,9 @@ our $x;
 EXPECT
 "our" variable $x redeclared at - line 4.
        (Did you mean "local" instead of "our"?)
+########
+# an our var being introduced should suppress errors about global syms
+use strict;
+use warnings;
+our $x unless $x;
+EXPECT