Change 28404 broke the construct s/foo/<<BAR/e. So, try to be more
[p5sagit/p5-mst-13.2.git] / t / op / inc.t
index f360c03..3eec5cd 100755 (executable)
@@ -2,7 +2,7 @@
 
 # use strict;
 
-print "1..24\n";
+print "1..34\n";
 
 my $test = 1;
 
@@ -87,6 +87,12 @@ $b = -$a;
 $b=$b-1;
 ok ($b == -(++$a), $a);
 
+$a = undef;
+ok ($a++ eq '0', do { $a=undef; $a++ }, "postinc undef returns '0'");
+
+$a = undef;
+ok (!defined($a--), do { $a=undef; $a-- }, "postdec undef returns undef");
+
 # Verify that shared hash keys become unshared.
 
 sub check_same {
@@ -151,3 +157,40 @@ foreach (keys %postdec) {
 }
 
 check_same (\%orig, \%postdec);
+
+{
+    no warnings 'uninitialized';
+    my ($x, $y);
+    eval {
+       $y ="$x\n";
+       ++$x;
+    };
+    ok($x == 1, $x);
+    ok($@ eq '', $@);
+
+    my ($p, $q);
+    eval {
+       $q ="$p\n";
+       --$p;
+    };
+    ok($p == -1, $p);
+    ok($@ eq '', $@);
+}
+
+$a = 2147483648;
+$c=--$a;
+ok ($a == 2147483647, $a);
+
+
+$a = 2147483648;
+$c=$a--;
+ok ($a == 2147483647, $a);
+
+{
+    use integer;
+    my $x = 0;
+    $x++;
+    ok ($x == 1, "(void) i_postinc");
+    $x--;
+    ok ($x == 0, "(void) i_postdec");
+}