[perl #3330] avoid an uncaught warning from op/inc.t
authorTony Cook <tony@develop-help.com>
Wed, 14 Aug 2013 00:05:18 +0000 (10:05 +1000)
committerTony Cook <tony@develop-help.com>
Wed, 14 Aug 2013 00:05:18 +0000 (10:05 +1000)
and add a warnings.t test case to check for that warning

t/lib/warnings/sv
t/op/inc.t

index 7116811..87bc368 100644 (file)
@@ -403,9 +403,11 @@ my $x = "a_c";
 ++$x;
 use warnings "numeric";
 $x = "a_c"; ++$x;
+$x = ${ qr/abc/ }; ++$x;
 $x = 0; ++$x; # none of these should warn
 $x = "ABC"; ++$x;
 $x = "ABC123"; ++$x;
 $x = " +10"; ++$x;
 EXPECT
 Argument "a_c" treated as 0 in increment (++) at - line 5.
+Argument "(?^:abc)" treated as 0 in increment (++) at - line 6.
index 8db0660..5135ab7 100644 (file)
@@ -274,9 +274,12 @@ isnt(scalar eval { my $pvbm = PVBM; --$pvbm }, undef, "predecrement defined");
 $_ = ${qr //};
 $_--;
 is($_, -1, 'regexp--');
-$_ = ${qr //};
-$_++;
-is($_, 1, 'regexp++');
+{
+    no warnings 'numeric';
+    $_ = ${qr //};
+    $_++;
+    is($_, 1, 'regexp++');
+}
 
 $_ = v97;
 $_++;