From: Bram Date: Tue, 29 Apr 2008 22:27:21 +0000 (+0200) Subject: extra tests for t/op/sprintf2.t (was Re: [perl #45383] RE: X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=9c2a5cfebcaca6cb620772a695fd0f59629bfdf5;p=p5sagit%2Fp5-mst-13.2.git extra tests for t/op/sprintf2.t (was Re: [perl #45383] RE: Message-ID: <20080429222721.rwupydwjk00okwc0@horde.wizbit.be> p4raw-id: //depot/perl@33765 --- diff --git a/t/op/sprintf2.t b/t/op/sprintf2.t index c92ab89..397c19e 100644 --- a/t/op/sprintf2.t +++ b/t/op/sprintf2.t @@ -6,7 +6,7 @@ BEGIN { require './test.pl'; } -plan tests => 1292; +plan tests => 1295; is( sprintf("%.40g ",0.01), @@ -134,3 +134,8 @@ for my $num (0, -1, 1) { } } +# test that %f doesn't panic with +Inf, -Inf, NaN [perl #45383] +foreach my $n (2**1e100, -2**1e100, 2**1e100/2**1e100) { # +Inf, -Inf, NaN + eval { my $f = sprintf("%f", $n); }; + is $@, "", "sprintf(\"%f\", $n)"; +}