Change 28404 broke the construct s/foo/<<BAR/e. So, try to be more
[p5sagit/p5-mst-13.2.git] / t / op / write.t
index 59fe268..25101d1 100755 (executable)
@@ -58,7 +58,7 @@ for my $tref ( @NumTests ){
 my $bas_tests = 20;
 
 # number of tests in section 3
-my $hmb_tests = 37;
+my $hmb_tests = 39;
 
 printf "1..%d\n", $bas_tests + $num_tests + $hmb_tests;
 
@@ -365,7 +365,8 @@ $v
     # must fail since we have a trailing ; in the eval'ed string (WL)
     my @v = ('k');
     eval "format OUT14 = \n@\n\@v";
-    print $@ ? "ok 14\n" : "not ok 14\n";
+    print +($@ && $@ =~ /Format not terminated/)
+      ? "ok 14\n" : "not ok 14 $@\n";
 
 }
 
@@ -431,7 +432,8 @@ EOD
 .
     open(OUT18, '>Op_write.tmp') || die "Can't create Op_write.tmp";
     eval { write(OUT18); };
-    print $@ ? "ok 18\n" : "not ok 18\n";
+    print +($@ && $@ =~ /Repeated format line will never terminate/)
+      ? "ok 18\n" : "not ok 18: $@\n";
     close OUT18 or die "Could not close: $!";
 }
 
@@ -524,6 +526,22 @@ if ($^O eq 'VMS' || $^O eq 'MSWin32' || $^O eq 'dos' || $^O eq 'MacOS' ||
 
 use strict;    # Amazed that this hackery can be made strict ...
 
+# DAPM. Exercise a couple of error codepaths
+
+{
+    local $~ = '';
+    eval { write };
+    print "not " unless $@ and $@ =~ /Not a format reference/;
+    print "ok $test - Not a format reference\n";
+    $test++;
+
+    $~ = "NOSUCHFORMAT";
+    eval { write };
+    print "not " unless $@ and $@ =~ /Undefined format/;
+    print "ok $test - Undefined format\n";
+    $test++;
+}
+
 # Just a complete test for format, including top-, left- and bottom marging
 # and format detection through glob entries
 
@@ -595,7 +613,7 @@ if ($opened) {
        }
     }
     close FROM_CHILD;
-    print + (@data?"not ":""), "ok ", $test++, " - too litle output\n";
+    print + (@data?"not ":""), "ok ", $test++, " - too little output\n";
     exit;
 }