From: Nicholas Clark Date: Sun, 11 Dec 2005 19:49:53 +0000 (+0000) Subject: Move the $data and $result munging into the test preparation loop. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=0a52d15ba5fbf8c2d2178fca6186b8b527a2e596;p=p5sagit%2Fp5-mst-13.2.git Move the $data and $result munging into the test preparation loop. p4raw-id: //depot/perl@26323 --- diff --git a/t/op/sprintf.t b/t/op/sprintf.t index d7f71e7..8f2ee05 100755 --- a/t/op/sprintf.t +++ b/t/op/sprintf.t @@ -12,28 +12,11 @@ BEGIN { } use warnings; use Config; +use strict; -# strictness my @tests = (); my ($i, $template, $data, $result, $comment, $w, $x, $evalData, $n, $p); -while () { - s/^\s*>//; s/<\s*$//; - push @tests, [split(/<\s*>/, $_, 4)]; -} - -print '1..', scalar @tests, "\n"; - -$SIG{__WARN__} = sub { - if ($_[0] =~ /^Invalid conversion/) { - $w = ' INVALID'; - } elsif ($_[0] =~ /^Use of uninitialized value/) { - $w = ' UNINIT'; - } else { - warn @_; - } -}; - my $Is_VMS_VAX = 0; # We use HW_MODEL since ARCH_NAME was not in VMS V5.* if ($^O eq 'VMS') { @@ -45,8 +28,9 @@ if ($^O eq 'VMS') { # No %Config. my $Is_Ultrix_VAX = $^O eq 'ultrix' && `uname -m` =~ /^VAX$/; -for ($i = 1; @tests; $i++) { - ($template, $data, $result, $comment) = @{shift @tests}; +while () { + s/^\s*>//; s/<\s*$//; + ($template, $data, $result, $comment) = split(/<\s*>/, $_, 4); if ($^O eq 'os390' || $^O eq 's390') { # non-IEEE (s390 is UTS) $data =~ s/([eE])96$/${1}63/; # smaller exponents $result =~ s/([eE]\+)102$/${1}69/; # " " @@ -62,6 +46,23 @@ for ($i = 1; @tests; $i++) { $data =~ s/([eE])\-101$/${1}-24/; # larger exponents $result =~ s/([eE])\-102$/${1}-25/; # " " } + push @tests, [$template, $data, $result, $comment]; +} + +print '1..', scalar @tests, "\n"; + +$SIG{__WARN__} = sub { + if ($_[0] =~ /^Invalid conversion/) { + $w = ' INVALID'; + } elsif ($_[0] =~ /^Use of uninitialized value/) { + $w = ' UNINIT'; + } else { + warn @_; + } +}; + +for ($i = 1; @tests; $i++) { + ($template, $data, $result, $comment) = @{shift @tests}; $evalData = eval $data; $w = undef; $x = sprintf(">$template<",