1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128
|
use strict;
use warnings;
use Test::More tests => 15;
use Test::NoWarnings;
use Test::DZil;
is_deeply getMetadata({}),
{}
, "no params generate no metadata";
is_deeply getMetadata({ 'bugtracker.rt' => 1}),
{
'bugtracker' => {
'web' => 'https://rt.cpan.org/Public/Dist/Display.html?Name=DZT-Sample',
'mailto' => 'bug-DZT-Sample@rt.cpan.org'
}
}
, "bugrtracker.rt is known";
is_deeply getMetadata({ 'bugtracker.github' => 'user:ajgb' }),
{
'bugtracker' => {
'web' => 'https://github.com/ajgb/dzt-sample/issues',
}
}
, "bugrtracker.github is known";
is_deeply getMetadata({ 'bugtracker.bitbucket' => 'user:xenoterracide' }), {
'bugtracker' => {
'web' => 'https://bitbucket.org/xenoterracide/dzt-sample/issues',
}
}, "bugrtracker.bitbucket is known";
is_deeply getMetadata({ 'bugtracker.other' => 1 }),
{ }
, "bugrtracker.other is not recognised";
is_deeply getMetadata({ 'repository.github' => 'user:ajgb' }),
{
'repository' => {
'web' => 'https://github.com/ajgb/dzt-sample',
'url' => 'git://github.com/ajgb/dzt-sample.git',
'type' => 'git',
}
}
, "repository.github is known";
is_deeply getMetadata({ 'repository.bitbucket' => 'user:xenoterracide' }),
{
'repository' => {
'web' => 'https://bitbucket.org/xenoterracide/dzt-sample',
'url' => 'git://bitbucket.org:xenoterracide/dzt-sample.git',
'type' => 'git',
}
}
, "repository.bitbucket is known";
is_deeply getMetadata({ 'repository.GitHub' => 'user:ajgb' }),
{
'repository' => {
'web' => 'https://github.com/ajgb/dzt-sample',
'url' => 'git://github.com/ajgb/dzt-sample.git',
'type' => 'git',
}
}
, "repository.GitHub is known";
is_deeply getMetadata({ 'repository.gitmo' => 1 }),
{
'repository' => {
'web' => 'http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=gitmo/DZT-Sample.git;a=summary',
'url' => 'git://git.moose.perl.org/DZT-Sample.git',
'type' => 'git',
}
}
, "repository.gitmo is known";
is_deeply getMetadata({ 'repository.catsvn' => 1 }),
{
'repository' => {
'web' => 'http://dev.catalystframework.org/svnweb/Catalyst/browse/DZT-Sample',
'url' => 'http://dev.catalyst.perl.org/repos/Catalyst/DZT-Sample/',
'type' => 'svn',
}
}
, "repository.catsvn is known";
for (qw(catagits p5sagit dbsrgits)) {
is_deeply getMetadata({ "repository.$_" => 1 }),
{
'repository' => {
'web' => "http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=$_/DZT-Sample.git;a=summary",
'url' => "git://git.shadowcat.co.uk/$_/DZT-Sample.git",
'type' => 'git',
}
}
, "repository.$_ is known";
};
is_deeply getMetadata({ 'homepage' => 'http://myperlprojects.org/%{lcdist}/' } ),
{
'homepage' => 'http://myperlprojects.org/dzt-sample/'
}
, "custom params passed and processed";
sub getMetadata {
my $args = shift;
my $tzil = Builder->from_config(
{ dist_root => 't/does-not-exist' },
{
add_files => {
'source/dist.ini' => simple_ini(
[ AutoMetaResources => $args ],
),
},
},
);
return $tzil->distmeta->{resources};
}
|