'""' => \&_stringify,
);
-my $int_rx = qr/[0-9]+/;
-my $positive_int_rx = qr/0*[1-9][0-9]*/;
-my $letter_rx = qr/[a-zA-Z]/;
-my $dotted_num_rx = qr/$int_rx(?:\.$int_rx)*/o;
+my $int_rx = qr/[0-9]+/;
+my $letter_rx = qr/[a-zA-Z]/;
+my $dotted_num_rx = qr/$int_rx(?:\.$int_rx)*/o;
my @suffixes = qw<alpha beta pre rc normal p>;
my $suffix_rx = join '|', grep !/^normal$/, @suffixes;
our $version_rx = qr{
$dotted_num_rx $letter_rx?
- (?:_$suffix_rx$positive_int_rx?)*
- (?:-r$positive_int_rx)?
+ (?:_$suffix_rx$int_rx?)*
+ (?:-r$int_rx)?
}xo;
my $capturing_version_rx = qr{
($dotted_num_rx) ($letter_rx)?
- ((?:_$suffix_rx$positive_int_rx?)*)
- (?:-r($positive_int_rx))?
+ ((?:_$suffix_rx$int_rx?)*)
+ (?:-r($int_rx))?
}xo;
=head1 METHODS
string => $vstring,
version => [ split /\.+/, $1 ],
letter => $2,
- suffixes => [ map /_($suffix_rx)($positive_int_rx)?/go, $3 ],
+ suffixes => [ map /_($suffix_rx)($int_rx)?/go, $3 ],
revision => $4,
}, $class;
}
use strict;
use warnings;
-use Test::More tests => 3 + (2 + 2 * 3) * (66 + 4 * 7);
+use Test::More tests => 3 + (2 + 2 * 3) * (69 + 4 * 7);
use CPANPLUS::Dist::Gentoo::Version;
[ "1.1_${_}1", "1.0_${_}2" => 1 ],
} qw(alpha beta pre rc)),
- [ '1.0', '1.0_p' => -1 ],
+ [ '1.0', '1.0_p0' => -1 ],
+ [ '1.0', '1.0_p1' => -1 ],
+ [ '1.0_p', '1.0_p0' => 0 ],
[ '1.0a', '1.0_p' => 1 ],
[ '1.0', '1.0_p1' => -1 ],
[ '1.0_p1', '1.0_p1' => 0 ],
[ '1.0_beta1', '1.0_pre1' => -1 ],
[ '1.0_pre1', '1.0_rc1' => -1 ],
[ '1.0_rc1', '1.0' => -1 ],
- [ '1.0', '1.0_p1' => -1 ],
[ '1.0_alpha', '1.0_alpha_alpha' => 1 ],
[ '1.0_beta', '1.0_beta_beta' => 1 ],
[ '1.0_pre1_rc2', '1.0_pre1_rc2' => 0 ],
[ '1.0_pre1_rc2', '1.0_pre1_rc3' => -1 ],
+ [ '1.0', '1.0-r0' => 0 ],
[ '1.0', '1.0-r1' => -1 ],
[ '1.0-r1', '1.0-r1' => 0 ],
[ '1.0-r1', '1.0-r2' => -1 ],
[ '1.1-r1', '1.0-r2' => 1 ],
+ [ '1.2_p0-r0', '1.2_p', 0 ],
[ '1.2_p1-r1', '1.2_p1', 1 ],
[ '1.2_p1-r1', '1.2_p1_p1', -1 ],
[ '1.2_p1_pre2-r1', '1.2_p1-r1', -1 ],