Acme-CPANAuthors-InMemoriam
view release on metacpan or search on metacpan
t/10inmemoriam.t view on Meta::CPAN
#!perl
use strict;
use warnings;
use Test::More;
plan skip_all => "can't load Acme::CPANAuthors"
unless eval "use Acme::CPANAuthors; 1";
plan tests => 9;
my $authors = eval { Acme::CPANAuthors->new("InMemoriam") };
is( $@, "", "creating a new Acme::CPANAuthors object with InMemoriam authors" );
isa_ok( $authors, "Acme::CPANAuthors" );
my $number = 29;
is( $authors->count, $number, " .. \$authors->count matches current count" );
my @ids = $authors->id;
cmp_ok( ~~@ids, ">", 0, " .. \$authors->id gives a non-empty list" );
is( ~~@ids, $number, " .. \$authors->id equals \$authors->count" );
SKIP: {
my $file;
eval { $file = Acme::CPANAuthors::Utils::_cpan_authors_file() };
skip "CPAN configuration not available", 4 if($@ || !$file);
$file = undef;
eval { $file = Acme::CPANAuthors::Utils::_cpan_packages_file() };
skip "CPAN configuration not available", 4 if($@ || !$file);
my @distros = $authors->distributions('IVORW');
cmp_ok( ~~@distros, ">", 0, " .. \$authors->distributions('IVORW') gives a non-empty list" );
@distros = $authors->distributions('XXXXXX');
cmp_ok( ~~@distros, "==", 0, " .. \$authors->distributions('XXXXXX') gives an empty list" );
my $name = $authors->name('IVORW');
is($name, "Ivor Williams", " .. \$authors->name('IVORW') returns Ivor Williams" );
# SKIP: {
# skip "en.gravatar.com is not available", 2
# if(pingtest('en.gravatar.com'));
#
# my $url;
# eval { $url = $authors->avatar_url('IVORW') };
# skip "en.gravatar.com is not available", 1 if($@);
# $url ||= '';
# is($url, 'http://www.gravatar.com/avatar/2459f554c069e44527716e3f35e1d0d1', ".. \$authors->avatar_url('IVORW') returns a URL" );
#
# eval { $url = $authors->avatar_url('BARBIE') };
# skip "en.gravatar.com is not available", 1 if($@);
# $url ||= '';
# cmp_ok( length($url), ">", 0, " .. \$authors->avatar_url('BINGOS') gives a non-empty string" );
# }
SKIP: {
skip "api.cpanauthors.org is not available", 1
if(pingtest('api.cpanauthors.org'));
my $kwalitee;
eval { $kwalitee = $authors->kwalitee('IVORW') };
skip "api.cpanauthors.org is not available", 1 if($@);
isa_ok( $kwalitee, "HASH", " .. \$authors->kwalitee('IVORW')" );
}
}
sub pingtest {
my $domain = shift or return 1;
my $cmd = $^O =~ /solaris/i ? "ping -s $domain 56 1" :
$^O =~ /dos|os2|mswin32|netware|cygwin/i ? "ping -n 1 $domain "
: "ping -c 1 $domain >/dev/null 2>&1";
eval { system($cmd) };
if($@) { # can't find ping, or wrong arguments?
diag($@);
return 1;
}
my $retcode = $? >> 8; # ping returns 1 if unable to connect
return $retcode;
}
t/90podtest.t view on Meta::CPAN
#!perl -T
use strict;
use warnings;
use Test::More;
# Skip if doing a regular install
plan skip_all => "Author tests not required for installation"
unless ( $ENV{AUTOMATED_TESTING} );
eval "use Test::Pod 1.00";
plan skip_all => "Test::Pod 1.00 required for testing POD" if $@;
all_pod_files_ok();
t/91podcover.t view on Meta::CPAN
#!perl -T
use strict;
use warnings;
use Test::More;
# Skip if doing a regular install
plan skip_all => "Author tests not required for installation"
unless ( $ENV{AUTOMATED_TESTING} );
eval "use Test::Pod::Coverage 0.08";
plan skip_all => "Test::Pod::Coverage 0.08 required for testing POD coverage" if $@;
all_pod_coverage_ok();
t/94metatest.t view on Meta::CPAN
#!perl -T
use strict;
use warnings;
use Test::More;
# Skip if doing a regular install
plan skip_all => "Author tests not required for installation"
unless ( $ENV{AUTOMATED_TESTING} );
eval "use Test::CPAN::Meta";
plan skip_all => "Test::CPAN::Meta required for testing META.yml" if $@;
plan 'no_plan';
my $meta = meta_spec_ok(undef,undef,@_);
use Acme::CPANAuthors::InMemoriam;
my $version = $Acme::CPANAuthors::InMemoriam::VERSION;
is($meta->{version},$version,
'META.yml distribution version matches');
if($meta->{provides}) {
for my $mod (keys %{$meta->{provides}}) {
is($meta->{provides}{$mod}{version},$version,
"META.yml entry [$mod] version matches distribution version");
eval "require $mod";
my $VERSION = '$' . $mod . '::VERSION';
my $v = eval "$VERSION";
is($meta->{provides}{$mod}{version},$v,
"META.json entry [$mod] version matches module version");
isnt($meta->{provides}{$mod}{version},0);
}
}
t/96metatest.t view on Meta::CPAN
#!perl -T
use strict;
use warnings;
use Test::More;
# Skip if doing a regular install
plan skip_all => "Author tests not required for installation"
unless ( $ENV{AUTOMATED_TESTING} );
eval "use Test::CPAN::Meta::JSON";
plan skip_all => "Test::CPAN::Meta::JSON required for testing META.json files" if $@;
plan 'no_plan';
my $meta = meta_spec_ok(undef,undef,@_);
use Acme::CPANAuthors::InMemoriam;
my $version = $Acme::CPANAuthors::InMemoriam::VERSION;
is($meta->{version},$version,
'META.json distribution version matches');
if($meta->{provides}) {
for my $mod (keys %{$meta->{provides}}) {
is($meta->{provides}{$mod}{version},$version,
"META.json entry [$mod] version matches distribution version");
eval "require $mod";
my $VERSION = '$' . $mod . '::VERSION';
my $v = eval "$VERSION";
is($meta->{provides}{$mod}{version},$v,
"META.json entry [$mod] version matches module version");
isnt($meta->{provides}{$mod}{version},0);
}
}
( run in 0.588 second using v1.01-cache-2.11-cpan-5a3173703d6 )