This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Integrate:
authorNicholas Clark <nick@ccl4.org>
Wed, 23 Jun 2004 15:54:27 +0000 (15:54 +0000)
committerNicholas Clark <nick@ccl4.org>
Wed, 23 Jun 2004 15:54:27 +0000 (15:54 +0000)
[ 22960]
When expecting an error, it's best to check the text you got, rather
than blindly assuming that it's correct.
p4raw-link: @22960 on //depot/perl: ee09ed4c5400432b740fa28e81457acfd0edfb65

p4raw-id: //depot/maint-5.8/perl@22987
p4raw-integrated: from //depot/perl@22986 'merge in' t/op/write.t
(@22485..)

t/op/write.t

index a3a37de..7bde003 100755 (executable)
@@ -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: $!";
 }