# Test quoted number processing
diag "tests with quoted numbers" unless $ENV{PERL_CORE};
$version = $CLASS->new("5.005_03");
- is ( "$version" , "5.5_30" , '"5.005_03" eq "5.5_30"' );
+ is ( "$version" , "5.005_030" , '"5.005_03" eq "5.005_030"' );
$version = $CLASS->new("v1.23");
is ( "$version" , "1.23.0" , '"v1.23" eq "1.23.0"' );
* floating point number, i.e. not quoted in any way
*/
if ( !qv && s > start+1 && saw_period == 1 ) {
- mult *= 100;
+ mult *= 100;
while ( s < end ) {
orev = rev;
rev += (*s - '0') * mult;
*/
len = 2 - len;
while (len-- > 0)
- av_push((AV *)sv, newSViv(0));
+ av_push((AV *)sv, newSViv(0));
}
return s;
}
if ( len > 0 )
{
digit = SvIVX(*av_fetch((AV *)vs, len, 0));
-
- /* Don't display any additional trailing zeros */
if ( (int)PERL_ABS(digit) != 0 || len == 1 )
{
+ if ( digit < 0 ) /* alpha version */
+ Perl_sv_catpv(aTHX_ sv,"_");
+ /* Don't display additional trailing zeros */
Perl_sv_catpvf(aTHX_ sv,"%03d", (int)PERL_ABS(digit));
}
}
SV *
Perl_vstringify(pTHX_ SV *vs)
{
- I32 len;
+ I32 len, digit;
if ( SvROK(vs) )
vs = SvRV(vs);
len = av_len((AV *)vs);
+ digit = SvIVX(*av_fetch((AV *)vs, len, 0));
- if ( len < 2 )
+ if ( len < 2 || ( len == 2 && digit < 0 ) )
return vnumify(vs);
else
return vnormal(vs);