Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

fixing memorized-related bug

  • Loading branch information...
commit 0bf589ecfcf377c8c7ccc44a14ca26bc770cc08c 1 parent 1b8cde1
@semuel authored
Showing with 32 additions and 1 deletion.
  1. +2 −1  lib/Dist/Surveyor/Inquiry.pm
  2. +6 −0 t/02-inquery.t
  3. +24 −0 t/03-scanlib.t
View
3  lib/Dist/Surveyor/Inquiry.pm
@@ -74,7 +74,7 @@ my $locking_file;
sub perma_cache {
my $class = shift;
- my $db_generation = 2; # XXX increment on incompatible change
+ my $db_generation = 3; # XXX increment on incompatible change
my $pname = $FindBin::Script;
$pname =~ s/\..*$//;
my $memoize_file = "$pname-$db_generation.db";
@@ -95,6 +95,7 @@ for my $subname (@memoize_subs) {
my %memoize_args = (
SCALAR_CACHE => [ HASH => \%memoize_cache ],
LIST_CACHE => 'FAULT',
+ NORMALIZER => sub { return join("\034", $subname, @_) }
);
memoize($subname, %memoize_args);
}
View
6 t/02-inquery.t
@@ -1,6 +1,7 @@
use strict;
use warnings;
use Dist::Surveyor::Inquiry;
+use Data::Dumper;
use Test::More;
my $module_data = get_module_versions_in_release('SEMUELF', 'Dist-Surveyor-0.009');
@@ -24,4 +25,9 @@ my $releases = get_candidate_cpan_dist_releases("Dist::Surveyor::DB_File", "0.00
is_deeply([keys %$releases], ['Dist-Surveyor-0.009'], "Got the right release");
is( $releases->{'Dist-Surveyor-0.009'}->{path}, 'lib/Dist/Surveyor/DB_File.pm', "Found the file" );
+my $release_info = get_release_info('SEMUELF', 'Dist-Surveyor-0.009');
+is($release_info->{name}, 'Dist-Surveyor-0.009', "Got the right release");
+is($release_info->{download_url}, 'http://cpan.metacpan.org/authors/id/S/SE/SEMUELF/Dist-Surveyor-0.009.tar.gz',
+ "Got the right download URL");
+
done_testing();
View
24 t/03-scanlib.t
@@ -0,0 +1,24 @@
+use strict;
+use warnings;
+use Dist::Surveyor;
+use FindBin;
+use File::Spec;
+use Test::More;
+
+
+my $options = {
+ distro_key_mod_names => {},
+};
+my $libdirs = [ File::Spec->catdir($FindBin::Bin, "scanlib") ];
+my @installed_releases = determine_installed_releases($options, $libdirs);
+@installed_releases = sort { $a->{name} cmp $b->{name} } @installed_releases;
+is_deeply(
+ [ 'Dist-Surveyor-0.009', 'Test-Class-0.36', 'Test-Deep-0.084' ],
+ [ map $_->{name}, @installed_releases ],
+ "Got all three releases" );
+is_deeply(
+ ['100.00', '100.00', '2.78'],
+ [ map $_->{dist_data}->{percent_installed}, @installed_releases ],
+ "Got all three percents correctly" );
+
+done_testing();
Please sign in to comment.
Something went wrong with that request. Please try again.