diff options
author | Marcel Gruenauer (via RT) <perlbug-followup@perl.org> | 2013-01-22 12:02:43 -0800 |
---|---|---|
committer | David Mitchell <davem@iabyn.com> | 2013-01-28 16:59:09 +0000 |
commit | 483d2dbb51227340963639c47fe23c617648c5ae (patch) | |
tree | 63fb06219526290d5642fc3b588bbf50f0d70252 /t/op/sprintf.t | |
parent | 784b5d7d0d8938b46c5782fc396b61d9cfb7d251 (diff) | |
download | perl-483d2dbb51227340963639c47fe23c617648c5ae.tar.gz |
Convert t/op/sprintf.t to use test.pl
[perl #116513]
Diffstat (limited to 't/op/sprintf.t')
-rw-r--r-- | t/op/sprintf.t | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/t/op/sprintf.t b/t/op/sprintf.t index ca070322c7..372ca90eb7 100644 --- a/t/op/sprintf.t +++ b/t/op/sprintf.t @@ -16,9 +16,10 @@ use warnings; use version; use Config; use strict; +require './test.pl'; my @tests = (); -my ($i, $template, $data, $result, $comment, $w, $x, $evalData, $n, $p); +my ($template, $data, $result, $comment, $w, $x, $evalData, $n, $p); my $Is_VMS_VAX = 0; # We use HW_MODEL since ARCH_NAME was not in VMS V5.* @@ -55,7 +56,7 @@ while (<DATA>) { push @tests, [$template, $evalData, $result, $comment, $data]; } -print '1..', scalar @tests, "\n"; +plan(scalar @tests); $SIG{__WARN__} = sub { if ($_[0] =~ /^Invalid conversion/) { @@ -71,8 +72,8 @@ $SIG{__WARN__} = sub { } }; -for ($i = 1; @tests; $i++) { - ($template, $evalData, $result, $comment, $data) = @{shift @tests}; +for (@tests) { + ($template, $evalData, $result, $comment, $data) = @$_; $w = undef; $x = sprintf($template, @$evalData); $x = ">$x<" if defined $x; @@ -113,14 +114,14 @@ for ($i = 1; @tests; $i++) { } if ($x eq ">$result<") { - print "ok $i - >$result<\n"; + ok(1, ">$result<"); } elsif ($skip) { - print "ok $i - # skip $comment\n"; + ok(1, "skip $comment"); } elsif ($y eq ">$result<") # Some C libraries always give { # three-digit exponent - print("ok $i - # >$result< $x three-digit exponent accepted\n"); + ok(1, ">$result< $x three-digit exponent accepted"); } elsif ($result =~ /[-+]\d{3}$/ && # Suppress tests with modulo of exponent >= 100 on platforms @@ -128,13 +129,12 @@ for ($i = 1; @tests; $i++) { ((!eval {require POSIX}) || # Costly: only do this if we must! (length(&POSIX::DBL_MAX) - rindex(&POSIX::DBL_MAX, '+')) == 3)) { - print("ok $i - # >$template< >$data< >$result<", - " Suppressed: exponent out of range?\n"); + ok(1, + ">$template< >$data< >$result< Suppressed: exponent out of range?\n"); } else { - $y = ($x eq $y ? "" : " => $y"); - print("not ok $i - >$template< >$data< >$result< $x$y", - $comment ? " # $comment\n" : "\n"); + $y = ($x eq $y ? "" : " => $y"); + ok(0, ">$template< >$data< >$result< $x$y $comment"); } } |