In perl.git, the branch blead has been updated <http://perl5.git.perl.org/perl.git/commitdiff/a6075c7300c497a2e670c1d26bb60551c0075e32?hp=4db91b87664af670123581a2ec65e24b185ba6ed>
- Log ----------------------------------------------------------------- commit a6075c7300c497a2e670c1d26bb60551c0075e32 Author: John Peacock <[email protected]> Date: Sun Sep 16 07:09:59 2012 -0400 Bring bleadperl up to parity with CPAN for version.pm Please find attached a patch to bleadperl to bring up to date with the CPAN release of version.pm. This release was to deal primarily with an edge case in numifying alpha decimal versions: https://rt.cpan.org/Ticket/Display.html?id=79259 I've also synchronized all of the other version.pm test cases, so that the code in core is identical to the CPAN release. Signed-off-by: David Golden <[email protected]> ----------------------------------------------------------------------- Summary of changes: lib/version.pm | 2 +- lib/version/t/01base.t | 2 +- lib/version/t/02derived.t | 2 +- lib/version/t/03require.t | 2 +- lib/version/t/05sigdie.t | 2 +- lib/version/t/06noop.t | 2 +- lib/version/t/07locale.t | 2 +- lib/version/t/coretests.pm | 11 ++++++++++- util.c | 4 +++- 9 files changed, 20 insertions(+), 9 deletions(-) diff --git a/lib/version.pm b/lib/version.pm index 3fcc5aa..286dc79 100644 --- a/lib/version.pm +++ b/lib/version.pm @@ -6,7 +6,7 @@ use strict; use vars qw(@ISA $VERSION $CLASS $STRICT $LAX *declare *qv); -$VERSION = 0.99; +$VERSION = 0.9901; $CLASS = 'version'; diff --git a/lib/version/t/01base.t b/lib/version/t/01base.t index f5784cd..c84531d 100644 --- a/lib/version/t/01base.t +++ b/lib/version/t/01base.t @@ -9,7 +9,7 @@ use Test::More qw/no_plan/; BEGIN { (my $coretests = $0) =~ s'[^/]+\.t'coretests.pm'; require $coretests; - use_ok('version', 0.97); + use_ok('version', 0.9901); } diag "Tests with base class" unless $ENV{PERL_CORE}; diff --git a/lib/version/t/02derived.t b/lib/version/t/02derived.t index 3ea847e..ea683a9 100644 --- a/lib/version/t/02derived.t +++ b/lib/version/t/02derived.t @@ -10,7 +10,7 @@ use File::Temp qw/tempfile/; BEGIN { (my $coretests = $0) =~ s'[^/]+\.t'coretests.pm'; require $coretests; - use_ok("version", 0.97); + use_ok("version", 0.9901); # If we made it this far, we are ok. } diff --git a/lib/version/t/03require.t b/lib/version/t/03require.t index 90d33eb..3d99cb1 100644 --- a/lib/version/t/03require.t +++ b/lib/version/t/03require.t @@ -14,7 +14,7 @@ BEGIN { # Don't want to use, because we need to make sure that the import doesn't # fire just yet (some code does this to avoid importing qv() and delare()). require_ok("version"); -is $version::VERSION, 0.99, "Make sure we have the correct class"; +is $version::VERSION, 0.9901, "Make sure we have the correct class"; ok(!"main"->can("qv"), "We don't have the imported qv()"); ok(!"main"->can("declare"), "We don't have the imported declare()"); diff --git a/lib/version/t/05sigdie.t b/lib/version/t/05sigdie.t index 2a33339..dd785d5 100644 --- a/lib/version/t/05sigdie.t +++ b/lib/version/t/05sigdie.t @@ -15,7 +15,7 @@ BEGIN { BEGIN { - use version 0.97; + use version 0.9901; } pass "Didn't get caught by the wrong DIE handler, which is a good thing"; diff --git a/lib/version/t/06noop.t b/lib/version/t/06noop.t index 63f7073..ff556ad 100644 --- a/lib/version/t/06noop.t +++ b/lib/version/t/06noop.t @@ -7,7 +7,7 @@ use Test::More qw/no_plan/; BEGIN { - use_ok('version', 0.97); + use_ok('version', 0.9901); } my $v1 = version->new('1.2'); diff --git a/lib/version/t/07locale.t b/lib/version/t/07locale.t index 506b1bf..01b51a7 100644 --- a/lib/version/t/07locale.t +++ b/lib/version/t/07locale.t @@ -10,7 +10,7 @@ use POSIX qw/locale_h/; use Test::More tests => 7; BEGIN { - use_ok('version', 0.97); + use_ok('version', 0.9901); } SKIP: { diff --git a/lib/version/t/coretests.pm b/lib/version/t/coretests.pm index 3f785e4..2283f93 100644 --- a/lib/version/t/coretests.pm +++ b/lib/version/t/coretests.pm @@ -538,9 +538,10 @@ EOF { # https://rt.cpan.org/Ticket/Display.html?id=72365 # https://rt.perl.org/rt3/Ticket/Display.html?id=102586 + # https://rt.cpan.org/Ticket/Display.html?id=78328 eval 'my $v = $CLASS->$method("version")'; like $@, qr/Invalid version format/, - 'The string "version" is not a version'; + "The string 'version' is not a version for $method"; eval 'my $v = $CLASS->$method("ver510n")'; like $@, qr/Invalid version format/, 'All strings starting with "v" are not versions'; @@ -593,6 +594,14 @@ SKIP: { eval { _112478->VERSION(9e99) }; unlike $@, qr/panic/, '->VERSION(9e99) does not panic'; } + + { # https://rt.cpan.org/Ticket/Display.html?id=79259 + my $v = $CLASS->new("0.52_0"); + ok $v->is_alpha, 'Just checking'; + is $v->numify, '0.520', 'Correctly nummified'; + } + } 1; + diff --git a/util.c b/util.c index 64c871c..8bd2094 100644 --- a/util.c +++ b/util.c @@ -4364,6 +4364,7 @@ dotted_decimal_version: } /* end if dotted-decimal */ else { /* decimal versions */ + int j = 0; /* may need this later */ /* special strict case for leading '.' or '0' */ if (strict) { if (*d == '.') { @@ -4426,7 +4427,7 @@ dotted_decimal_version: } while (isDIGIT(*d)) { - d++; + d++; j++; if (*d == '.' && isDIGIT(d[-1])) { if (alpha) { BADVERSION(s,errstr,"Invalid version format (underscores before decimal)"); @@ -4448,6 +4449,7 @@ dotted_decimal_version: if ( ! isDIGIT(d[1]) ) { BADVERSION(s,errstr,"Invalid version format (misplaced underscore)"); } + width = j; d++; alpha = TRUE; } -- Perl5 Master Repository
