From: Nicholas Clark Date: Mon, 12 Dec 2005 15:24:06 +0000 (+0000) Subject: Check that %v$foo does not crash. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=343ef7498d1a8623949697479cbfea3822ffafe9;p=p5sagit%2Fp5-mst-13.2.git Check that %v$foo does not crash. p4raw-id: //depot/perl@26332 --- diff --git a/t/op/sprintf2.t b/t/op/sprintf2.t index d668e60..6527a13 100644 --- a/t/op/sprintf2.t +++ b/t/op/sprintf2.t @@ -6,7 +6,7 @@ BEGIN { require './test.pl'; } -plan tests => 7; +plan tests => 7 + 256; is( sprintf("%.40g ",0.01), @@ -54,3 +54,16 @@ fresh_perl_is( is($bad, 0, "unexpected warnings"); } +{ + foreach my $ord (0 .. 255) { + my $bad = 0; + local $SIG{__WARN__} = sub { + if ($_[0] !~ /^Invalid conversion in sprintf/) { + warn $_[0]; + $bad++; + } + }; + my $r = eval {sprintf '%v' . chr $ord}; + is ($bad, 0, "pattern '%v' . chr $ord"); + } +}