diff options
author | Robin Barker <RMBarker@cpan.org> | 2003-06-11 19:10:14 +0100 |
---|---|---|
committer | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2003-06-12 20:49:25 +0000 |
commit | dca6e23fb83957e896abba24cceb553cbf56fb78 (patch) | |
tree | 5c250bf50f16eda93a9c311c1ff60f94f728bdd9 /t | |
parent | f93414403b07cda0cb271cd283f020f4981ff2c8 (diff) | |
download | perl-dca6e23fb83957e896abba24cceb553cbf56fb78.tar.gz |
Add a new warning, "Newline in left-justified string for printf/sprintf"
to be issued if the string to be left-justified by s?printf contains
a newline.
Subject: [PATCH] RE: [perl #22599] Strange behaviour when combining foreac h and printf
Message-ID: <533D273D4014D411AB1D00062938C4D904046571@hotel.npl.co.uk>
p4raw-id: //depot/perl@19752
Diffstat (limited to 't')
-rw-r--r-- | t/lib/warnings/sv | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/t/lib/warnings/sv b/t/lib/warnings/sv index d9aa827fc8..6060fbc38d 100644 --- a/t/lib/warnings/sv +++ b/t/lib/warnings/sv @@ -345,3 +345,22 @@ no warnings 'numeric' ; $a = "\x{100}\x{200}"; $a = -$a; EXPECT Argument "\x{100}\x{200}" isn't numeric in negation (-) at - line 3. +######## +# sv.c +open F, ">".($^O eq 'VMS'? 'NL:' : '/dev/null') ; +use warnings 'printf'; +$a = "a\nb"; +$s = sprintf "%4s", $a; +printf F "%4s", $a; +$s = sprintf "%-4s", $a; +printf F "%-4s", $a; +$s = sprintf "%*s", -4, $a; +no warnings 'printf'; +$s = sprintf "%4s", $a; +printf F "%4s", $a; +$s = sprintf "%-4s", $a; +printf F "%-4s", $a; +EXPECT +Newline in left-justified string for sprintf at - line 7. +Newline in left-justified string for printf at - line 8. +Newline in left-justified string for sprintf at - line 9. |