diff options
author | Nicholas Clark <nick@ccl4.org> | 2005-12-11 19:49:53 +0000 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2005-12-11 19:49:53 +0000 |
commit | 0a52d15ba5fbf8c2d2178fca6186b8b527a2e596 (patch) | |
tree | fafcd9a83fb97e18df5b19184fb881192c975b45 /t/op/sprintf.t | |
parent | 26372e719d968db9587087a91713eb8747db7141 (diff) | |
download | perl-0a52d15ba5fbf8c2d2178fca6186b8b527a2e596.tar.gz |
Move the $data and $result munging into the test preparation loop.
p4raw-id: //depot/perl@26323
Diffstat (limited to 't/op/sprintf.t')
-rwxr-xr-x | t/op/sprintf.t | 41 |
1 files changed, 21 insertions, 20 deletions
diff --git a/t/op/sprintf.t b/t/op/sprintf.t index d7f71e7d04..8f2ee05636 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 (<DATA>) { - 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 (<DATA>) { + 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<", |