Permalink
Browse files

Allow for version numbers beginning with 'v'; test those cases.

  • Loading branch information...
jkeenan committed Feb 21, 2010
1 parent 3e13554 commit 157c43efe8412fcc3a9aa0cd1956f5265255c616
Showing with 15 additions and 1 deletion.
  1. +1 −0 lib/CPAN/Mini/Visit/Simple/Auxiliary.pm
  2. +14 −1 t/004_normalize_version_number.t
@@ -52,6 +52,7 @@ sub dedupe_superseded {
sub normalize_version_number {
my $v = shift;
my @captures = split /\./, $v;
+ $captures[0] =~ s/^v//;
my $normalized;
if ( $captures[0] eq q{} ) {
$normalized = 0;
@@ -5,7 +5,7 @@
use CPAN::Mini::Visit::Simple::Auxiliary qw(
normalize_version_number
);
-use Test::More tests => 5;
+use Test::More tests => 8;
my @got = ();
my ($expected, $vn);
@@ -182,6 +182,19 @@ $vn = '.002.9';
is( normalize_version_number($vn), '0.0000200009',
"Got expected normalization for $vn" );
+$vn = 'v0.2.2';
+is( normalize_version_number($vn), '0.0000200002',
+ "Got expected normalization for $vn" );
+
+$vn = 'v2.2.2';
+is( normalize_version_number($vn), '2.0000200002',
+ "Got expected normalization for $vn" );
+
+$vn = 'v.2.2';
+is( normalize_version_number($vn), '0.0000200002',
+ "Got expected normalization for $vn" );
+
+
__DATA__
2.1.2

0 comments on commit 157c43e

Please sign in to comment.