diff options
author | James E Keenan <jkeenan@cpan.org> | 2015-09-08 08:59:49 -0400 |
---|---|---|
committer | James E Keenan <jkeenan@cpan.org> | 2015-09-14 18:46:31 -0400 |
commit | 29b04a70d1bf9a10be65363f3f8d6dae44cfa6fc (patch) | |
tree | 24a790a7bda6eed94cdee174ab6148a3c273f1ca | |
parent | 69367d7f5f3a53ee8b6a2509cafc5e3b89ec0011 (diff) | |
download | perl-29b04a70d1bf9a10be65363f3f8d6dae44cfa6fc.tar.gz |
Add test for sprintf ordering by both explicit index and not.
Commit 638ca15 earlier in the 5.23 development cycle corrected a
long-standing bug in sprintf. Not surprisingly, code outside the
core built on this bug will now exhibit a different behavior.
CPAN library Text-sprintfn is one such case. One test in its
test suite began to fail; see
https://rt.cpan.org/Ticket/Display.html?id=105989.
This commit adds the test which failed in Text-sprintfn's t/01-basic.t to our
t/op/sprintf.t with the corrected test result. It also adds a 'printf'
version of that corrected expectation to pod/perlfunc.pod.
For: RT #125956
-rw-r--r-- | pod/perlfunc.pod | 9 | ||||
-rw-r--r-- | t/op/sprintf.t | 1 |
2 files changed, 6 insertions, 4 deletions
diff --git a/pod/perlfunc.pod b/pod/perlfunc.pod index 68d190f97f..b5fb4f1813 100644 --- a/pod/perlfunc.pod +++ b/pod/perlfunc.pod @@ -7410,10 +7410,11 @@ value to format. Here are some more examples; be aware that when using an explicit index, the C<$> may need escaping: - printf "%2\$d %d\n", 12, 34; # will print "34 12\n" - printf "%2\$d %d %d\n", 12, 34; # will print "34 12 34\n" - printf "%3\$d %d %d\n", 12, 34, 56; # will print "56 12 34\n" - printf "%2\$*3\$d %d\n", 12, 34, 3; # will print " 34 12\n" + printf "%2\$d %d\n", 12, 34; # will print "34 12\n" + printf "%2\$d %d %d\n", 12, 34; # will print "34 12 34\n" + printf "%3\$d %d %d\n", 12, 34, 56; # will print "56 12 34\n" + printf "%2\$*3\$d %d\n", 12, 34, 3; # will print " 34 12\n" + printf "%*1\$.*f\n", 4, 5, 10; # will print "5.0000\n" =back diff --git a/t/op/sprintf.t b/t/op/sprintf.t index db934c7100..c6550d0d54 100644 --- a/t/op/sprintf.t +++ b/t/op/sprintf.t @@ -312,6 +312,7 @@ __END__ >%4.*2$d< >[5,3]< > 005< >width with reordered precision< >%*3$.*2$d< >[5,3,4]< > 005< >reordered width with reordered precision< >%3$*2$.*1$d< >[3,4,5]< > 005< >reordered param, width, precision< +>%*1$.*f< >[4, 5, 10]< >5.0000< >perl #125956: reordered param, width, precision, floating point< >%d< >-1< >-1< >%-d< >-1< >-1< >%+d< >-1< >-1< |