fixed various test issues - 1365085

This commit is contained in:
Frank Cizmich
2014-09-03 14:43:24 -03:00
parent f0a0a8f737
commit 74c70cae92
3 changed files with 48 additions and 1 deletions

View File

@@ -75,6 +75,8 @@ SKIP: {
unless $root eq $trunk;
my @tags = split /\n/, `$bzr tags`;
# sort the version numbers (some bzr versions do not sort them)
@tags = sort { calc_value($a) <=> calc_value($b) } @tags;
my ($current_tag) = $tags[-1] =~ /^(\S+)/;
is(
@@ -84,4 +86,18 @@ SKIP: {
);
}
# we use this function to help sort version numbers
sub calc_value {
my $version = shift;
$version =~ s/ +[^ ]*$//;
my $value = 0;
my $exp = 0;
foreach my $num (reverse split /\./, $version) {
$value += $num * 10 ** $exp++;
}
print "$version = $value\n";
return $value;
}
done_testing;