From: Dave Mitchell Date: Wed, 18 Feb 2004 13:22:13 +0000 (+0000) Subject: fix write test: -small_number may be displayed as 00.00 or -0.00 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=8975a8c255049aa172fbac58615aa6b8f5076610;p=p5sagit%2Fp5-mst-13.2.git fix write test: -small_number may be displayed as 00.00 or -0.00 p4raw-id: //depot/perl@22337 --- diff --git a/t/op/write.t b/t/op/write.t index ae9f8a5..52ba517 100755 --- a/t/op/write.t +++ b/t/op/write.t @@ -33,7 +33,7 @@ my @NumTests = ( 999.99499, '999.99', -100, '######' ], [ '@0#.##', 0, '000.00', 1, '001.00', 10, '010.00', - -0.0001, '-00.00' ], + -0.0001, qr/^[\-0]00\.00$/ ], ); @@ -486,8 +486,11 @@ for my $tref ( @NumTests ){ my $expected = shift @$tref; my $writeres = swrite( $writefmt, $val ); $nt++; - - print $expected eq $writeres + my $ok = ref($expected) + ? $writeres =~ $expected + : $writeres eq $expected; + + print $ok ? "ok $nt\n" : "not ok $nt\n# f=[$writefmt] exp=[$expected] got=[$writeres]\n"; }