In perl.git, the branch blead has been updated

<http://perl5.git.perl.org/perl.git/commitdiff/45d74e11808ef284790f2e31eb9ae23f46569f07?hp=6ef69d5658db4ad50735ca636cb8e029a4066d15>

- Log -----------------------------------------------------------------
commit 45d74e11808ef284790f2e31eb9ae23f46569f07
Author: Nicholas Clark <[email protected]>
Date:   Fri Mar 11 11:37:07 2011 +0000

    Refactor die_exit.t to loop over a list, rather than iterate on an hash.

M       t/op/die_exit.t

commit 02548dbe79b004d80fd1958f87c48f00a06a292d
Author: Nicholas Clark <[email protected]>
Date:   Fri Mar 11 11:29:23 2011 +0000

    Convert t/op/die_exit.t to test.pl

M       t/op/die_exit.t
-----------------------------------------------------------------------

Summary of changes:
 t/op/die_exit.t |   69 ++++++++++++++++++++++++------------------------------
 1 files changed, 31 insertions(+), 38 deletions(-)

diff --git a/t/op/die_exit.t b/t/op/die_exit.t
index 2ede2d9..390e0c5 100644
--- a/t/op/die_exit.t
+++ b/t/op/die_exit.t
@@ -1,4 +1,4 @@
-#!./perl
+#!./perl -w
 
 #
 # Verify that C<die> return the return code
@@ -8,39 +8,37 @@
 BEGIN {
     chdir 't' if -d 't';
     @INC = '../lib';
+    require './test.pl';
 }
 
-if ($^O eq 'mpeix') {
-    print "1..0 # Skip: broken on MPE/iX\n";
-    exit 0;
-}
+use strict;
 
-$| = 1;
+skip_all('broken on MPE/iX') if $^O eq 'mpeix';
 
-use strict;
+$| = 1;
 
-my %tests = (
-        1 => [   0,   0],
-        2 => [   0,   1], 
-        3 => [   0, 127], 
-        4 => [   0, 128], 
-        5 => [   0, 255], 
-        6 => [   0, 256], 
-        7 => [   0, 512], 
-        8 => [   1,   0],
-        9 => [   1,   1],
-       10 => [   1, 256],
-       11 => [ 128,   0],
-       12 => [ 128,   1],
-       13 => [ 128, 256],
-       14 => [ 255,   0],
-       15 => [ 255,   1],
-       16 => [ 255, 256],
+my @tests = (
+       [   0,   0],
+       [   0,   1],
+       [   0, 127],
+       [   0, 128],
+       [   0, 255],
+       [   0, 256],
+       [   0, 512],
+       [   1,   0],
+       [   1,   1],
+       [   1, 256],
+       [ 128,   0],
+       [ 128,   1],
+       [ 128, 256],
+       [ 255,   0],
+       [ 255,   1],
+       [ 255, 256],
        # see if implicit close preserves $?
-       17 => [  0,  512, '{ local *F; open F, q[TEST]; close F; $!=0 } die;'],
+       [  0,  512, '{ local *F; open F, q[TEST]; close F; $!=0 } die;'],
 );
 
-my $max = keys %tests;
+plan(tests => scalar @tests);
 
 my $vms_exit_mode = 0;
 
@@ -60,14 +58,12 @@ if ($^O eq 'VMS') {
     }
 }
 
-
-print "1..$max\n";
-
 # Dump any error messages from the dying processes off to a temp file.
-open(STDERR, ">die_exit.err") or die "Can't open temp error file:  $!";
+my $tempfile = tempfile();
+open STDERR, '>', $tempfile or die "Can't open temp error file $tempfile:  $!";
 
-foreach my $test (1 .. $max) {
-    my($bang, $query, $code) = @{$tests{$test}};
+foreach my $test (@tests) {
+    my($bang, $query, $code) = @$test;
     $code ||= 'die;';
     if ($^O eq 'MSWin32' || $^O eq 'NetWare' || $^O eq 'VMS') {
         system(qq{$^X -e "\$! = $bang; \$? = $query; $code"});
@@ -81,11 +77,8 @@ foreach my $test (1 .. $max) {
     # We only get the severity bits, which boils down to 4.  See L<perlvms/$?>.
     $bang = 4 if $vms_exit_mode;
 
-    printf "# 0x%04x  0x%04x  0x%04x\n", $exit, $bang, $query;
-    print "not " unless $exit == (($bang || ($query >> 8) || 255) << 8);
-    print "ok $test\n";
+    is($exit, (($bang || ($query >> 8) || 255) << 8),
+       sprintf "exit = 0x%04x bang = 0x%04x query = 0x%04x", $exit, $bang, 
$query);
 }
-    
-close STDERR;
-END { 1 while unlink 'die_exit.err' }
 
+close STDERR;

--
Perl5 Master Repository

Reply via email to