Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
t/model/archive: replace size check with content check
  • Loading branch information
mickeyn committed May 27, 2016
1 parent f0e0ff0 commit 0cb288b
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 10 deletions.
3 changes: 2 additions & 1 deletion cpanfile
Expand Up @@ -5,8 +5,9 @@ requires 'Archive::Tar', '2.04';
requires 'BackPAN::Index', '0.42';
requires 'CHI', '0.60';
requires 'CPAN::DistnameInfo', '0.12';
requires 'CPAN::Meta', '2.115005'; # Avoid issues with List::Util dep under carton install.
requires 'CPAN::Meta', '2.150005'; # Avoid issues with List::Util dep under carton install.
requires 'CPAN::Meta::Requirements', '2.140';
requires 'CPAN::Meta::YAML', '0.018';
requires 'Captcha::reCAPTCHA', '0.94';
requires 'Catalyst', '5.90103';
requires 'Catalyst::Action::RenderView';
Expand Down
24 changes: 15 additions & 9 deletions t/model/archive.t
Expand Up @@ -5,6 +5,7 @@ use warnings;

use MetaCPAN::TestHelpers qw( fakecpan_dir );
use Test::Most;
use Digest::SHA1 qw( sha1_hex );

my $CLASS = 'MetaCPAN::Model::Archive';
require_ok $CLASS;
Expand All @@ -22,12 +23,18 @@ subtest 'file does not exist' => sub {

subtest 'archive extraction' => sub {
my %want = (
'Some-1.00-TRIAL/lib/Some.pm' => 45,
'Some-1.00-TRIAL/Makefile.PL' => 172,
'Some-1.00-TRIAL/t/00-nop.t' => 41,
'Some-1.00-TRIAL/META.json' => 587,
'Some-1.00-TRIAL/META.yml' => 414,
'Some-1.00-TRIAL/MANIFEST' => 62,
'Some-1.00-TRIAL/lib/Some.pm' =>
'2f806b4c7413496966f52ef353984dde10b6477b',
'Some-1.00-TRIAL/Makefile.PL' =>
'bc7f47a8e0e9930f41c06e150c7d229cfd3feae7',
'Some-1.00-TRIAL/t/00-nop.t' =>
'2eba5fd5f9e08a9dcc1c5e2166b7d7d958caf377',
'Some-1.00-TRIAL/META.json' =>
'075033ae62d19864203ae413822be6846e101556',
'Some-1.00-TRIAL/META.yml' =>
'10f129398229a8b1cff0922d498f5982d976d247',
'Some-1.00-TRIAL/MANIFEST' =>
'e93d21831fb3d3cac905dbe852ba1a4a07abd991',
);

my $archive = $CLASS->new(
Expand All @@ -42,9 +49,8 @@ subtest 'archive extraction' => sub {

my $dir = $archive->extract;
for my $file ( keys %want ) {
my $size = $want{$file};

is -s $dir->file($file), $size, "size of $file";
my $digest = sha1_hex( $dir->file($file)->slurp );
is $digest, $want{$file}, "content of $file";
}
};

Expand Down

0 comments on commit 0cb288b

Please sign in to comment.