This is a live mirror of the Perl 5 development currently hosted at
https://github.com/perl/perl5
https://perl5.git.perl.org
/
perl5.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
ffdf997
)
Check that %v$foo does not crash.
author
Nicholas Clark
<nick@ccl4.org>
Mon, 12 Dec 2005 15:24:06 +0000
(15:24 +0000)
committer
Nicholas Clark
<nick@ccl4.org>
Mon, 12 Dec 2005 15:24:06 +0000
(15:24 +0000)
p4raw-id: //depot/perl@26332
t/op/sprintf2.t
patch
|
blob
|
blame
|
history
diff --git
a/t/op/sprintf2.t
b/t/op/sprintf2.t
index
d668e60
..
6527a13
100644
(file)
--- 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");
+ }
+}