In perl.git, the branch blead has been updated

<http://perl5.git.perl.org/perl.git/commitdiff/c142532219286314b83d763ae2a9ab5e34180ef0?hp=5b98cd54dff3b16344eab33ce6b09fb6fb1b89c2>

- Log -----------------------------------------------------------------
commit c142532219286314b83d763ae2a9ab5e34180ef0
Author: Vincent Pit <[email protected]>
Date:   Thu May 6 22:20:10 2010 +0200

    Make t/op/sprintf.t test multiple warnings

M       t/op/sprintf.t

commit d347ad18ecf3da70504843223bc83fa49705ebaf
Author: Vincent Pit <[email protected]>
Date:   Thu May 6 22:14:31 2010 +0200

    Stop returning 0 for sprintf("%.0g")
    
    And also from throwing two "Missing argument" warnings for this construct.
    
    This was a regression introduced by 
5b98cd54dff3b16344eab33ce6b09fb6fb1b89c2.

M       sv.c
M       t/op/sprintf.t

commit 1795af272b5e89d0c3027b37e9421fc209c07253
Author: Vincent Pit <[email protected]>
Date:   Thu May 6 22:35:14 2010 +0200

    Really test special sprintf formats

M       t/op/sprintf.t
-----------------------------------------------------------------------

Summary of changes:
 sv.c           |    4 +++-
 t/op/sprintf.t |   17 ++++++++++-------
 2 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/sv.c b/sv.c
index 4f2ad99..4fd9445 100644
--- a/sv.c
+++ b/sv.c
@@ -9391,8 +9391,10 @@ Perl_sv_vcatpvfn(pTHX_ SV *const sv, const char *const 
pat, const STRLEN patlen,
 
            if (svix < svmax)
                nv = SvNV(*svargs);
-           else
+           else {
                S_vcatpvfn_missing_argument(aTHX);
+               return;
+           }
            if (*pp == 'g') {
                /* Add check for digits != 0 because it seems that some
                   gconverts are buggy in this case, and we don't yet have
diff --git a/t/op/sprintf.t b/t/op/sprintf.t
index 8d93297..b153839 100644
--- a/t/op/sprintf.t
+++ b/t/op/sprintf.t
@@ -57,11 +57,11 @@ print '1..', scalar @tests, "\n";
 
 $SIG{__WARN__} = sub {
     if ($_[0] =~ /^Invalid conversion/) {
-       $w = ' INVALID';
+       $w .= ' INVALID';
     } elsif ($_[0] =~ /^Use of uninitialized value/) {
-       $w = ' UNINIT';
+       $w .= ' UNINIT';
     } elsif ($_[0] =~ /^Missing argument/) {
-       $w = ' MISSING';
+       $w .= ' MISSING';
     } else {
        warn @_;
     }
@@ -70,7 +70,8 @@ $SIG{__WARN__} = sub {
 for ($i = 1; @tests; $i++) {
     ($template, $evalData, $result, $comment, $data) = @{shift @tests};
     $w = undef;
-    $x = sprintf(">$template<", @$evalData);
+    $x = sprintf($template, @$evalData);
+    $x = ">$x<" if defined $x;
     substr($x, -1, 0) = $w if $w;
     # $x may have 3 exponent digits, not 2
     my $y = $x;
@@ -373,7 +374,7 @@ __END__
 >%+8.1f<    >-1234.875<   > -1234.9<
 >%*.*f<     >[5, 2, 12.3456]< >12.35<
 >%f<        >0<           >0.000000<
->%.0f<      >[]<          >0 MISSING<
+>%.0f<      >[]<          > MISSING<
 > %.0f<     >[]<          > 0 MISSING<
 >%.0f<      >0<           >0<
 >%.0f<      >2**38<       >274877906944<   >Should have exact int'l rep'n<
@@ -389,7 +390,9 @@ __END__
 >%g<        >12345.6789<  >12345.7<
 >%+g<       >12345.6789<  >+12345.7<
 >%#g<       >12345.6789<  >12345.7<
->%.0g<      >-0.0<       >-0<             >C99 standard mandates minus sign 
but C89 does not skip: MSWin32 VMS hpux:10.20 openbsd netbsd:1.5 irix darwin<
+>%.0g<      >[]<          > MISSING<
+> %.0g<     >[]<          > 0 MISSING<
+>%.0g<      >-0.0<        >-0<            >C99 standard mandates minus sign 
but C89 does not skip: MSWin32 VMS hpux:10.20 openbsd netbsd:1.5 irix darwin<
 >%.0g<      >12345.6789<  >1e+04<
 >%#.0g<     >12345.6789<  >1.e+04<
 >%.2g<      >12345.6789<  >1.2e+04<
@@ -684,7 +687,7 @@ __END__
 >%V-%s<                >["Hello"]<     >%V-Hello INVALID<
 >%K %d %d<     >[13, 29]<      >%K 13 29 INVALID<
 >%*.*K %d<     >[13, 29, 76]<  >%*.*K 13 INVALID<
->%4$K %d<      >[45, 67]<      >%4$K 45 INVALID<
+>%4$K %d<      >[45, 67]<      >%4$K 45 MISSING INVALID<
 >%d %K %d<     >[23, 45]<      >23 %K 45 INVALID<
 >%*v*999\$d %d %d<     >[11, 22, 33]<  >%*v*999\$d 11 22 INVALID<
 >%#b<          >0<     >0<

--
Perl5 Master Repository

Reply via email to