Alien-Base-ModuleBuild

 view release on metacpan or  search on metacpan

t/alien_base_modulebuild_repository.t  view on Meta::CPAN

subtest 'has_digest' => sub {

  local $default->{exact_filename} = 'gsl-1.9.tar.gz.sig';
  local $default->{exact_version}  = 1.9;

  is(
    Alien::Base::ModuleBuild::Repository::Test->new($default)->has_digest,
    F(),
    'no sha1 or sha256',
  );

  {
    local $default->{sha1} = 'foo';
    is(
      Alien::Base::ModuleBuild::Repository::Test->new($default)->has_digest,
      T(),
      'sha1'
    );
  }

  {
    local $default->{sha256} = 'foo';
    is(
      Alien::Base::ModuleBuild::Repository::Test->new($default)->has_digest,
      T(),
      'sha256',
    );
  }

  {
    local $default->{sha1}   = 'bar';
    local $default->{sha256} = 'foo';
    is(
      Alien::Base::ModuleBuild::Repository::Test->new($default)->has_digest,
      T(),
      'sha1 and sha256',
    );
  }

  delete $default->{exact_filename};
  delete $default->{exact_version};

  {
    local $default->{sha1}   = 'bar';
    local $default->{sha256} = 'foo';
    is(
      Alien::Base::ModuleBuild::Repository::Test->new($default)->has_digest,
      F(),
      'sha1 and sha256 and no exaxt',
    );
  }

};

done_testing;

package Alien::Base::ModuleBuild::Repository::Test;

use strict;
use warnings;
use parent 'Alien::Base::ModuleBuild::Repository';

sub is_network_fetch { $network_fetch }
sub is_secure_fetch  { $secure_fetch }

sub list_files {
  my $self = shift;
  #files from GNU GSL FTP server, fetched 1/24/2012
  my @files = ( qw/
    gsl-1.0-gsl-1.1.patch.gz
    gsl-1.0.tar.gz
    gsl-1.1-gsl-1.1.1.patch.gz
    gsl-1.1.1-gsl-1.2.patch.gz
    gsl-1.1.1.tar.gz
    gsl-1.1.tar.gz
    gsl-1.10-1.11.patch.gz
    gsl-1.10-1.11.patch.gz.sig
    gsl-1.10.tar.gz
    gsl-1.10.tar.gz.sig
    gsl-1.11-1.12.patch.gz
    gsl-1.11-1.12.patch.gz.sig
    gsl-1.11.tar.gz
    gsl-1.11.tar.gz.sig
    gsl-1.12-1.13.patch.gz
    gsl-1.12-1.13.patch.gz.sig
    gsl-1.12.tar.gz
    gsl-1.12.tar.gz.sig
    gsl-1.13-1.14.patch.gz
    gsl-1.13-1.14.patch.gz.sig
    gsl-1.13.tar.gz
    gsl-1.13.tar.gz.sig
    gsl-1.14.tar.gz
    gsl-1.14.tar.gz.sig
    gsl-1.15.tar.gz
    gsl-1.15.tar.gz.sig
    gsl-1.2-gsl-1.3.patch.gz
    gsl-1.2.tar.gz
    gsl-1.3-gsl-1.4.patch.gz
    gsl-1.3-gsl-1.4.patch.gz.asc
    gsl-1.3.tar.gz
    gsl-1.4-gsl-1.5.patch.gz
    gsl-1.4-gsl-1.5.patch.gz.sig
    gsl-1.4.tar.gz
    gsl-1.4.tar.gz.asc
    gsl-1.5-gsl-1.6.patch.gz
    gsl-1.5-gsl-1.6.patch.gz.sig
    gsl-1.5.tar.gz
    gsl-1.5.tar.gz.sig
    gsl-1.6-gsl-1.7.patch.gz
    gsl-1.6-gsl-1.7.patch.gz.sig
    gsl-1.6.tar.gz
    gsl-1.6.tar.gz.sig
    gsl-1.7-1.8.patch.gz
    gsl-1.7-1.8.patch.gz.sig
    gsl-1.7.tar.gz
    gsl-1.7.tar.gz.sig
    gsl-1.8-1.9.patch.gz
    gsl-1.8-1.9.patch.gz.sig
    gsl-1.8.tar.gz
    gsl-1.8.tar.gz.sig
    gsl-1.9-1.10.patch.gz



( run in 1.323 second using v1.01-cache-2.11-cpan-80ec619307d )