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 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150
|
use strict;
use warnings;
use Test::More 0.88;
use lib 't/lib';
use Test::DZil;
use JSON 2;
use YAML::Tiny;
{
# 2.0
my $tzil = Builder->from_config(
{ dist_root => 'corpus/dist/DZT' },
{
add_files => {
'source/dist.ini' => simple_ini(
'GatherDir',
[ MetaResources => HomePage => {homepage => 'http://bana.na/phone'}],
[ MetaResources => License => {license => 'http://b.sd/license' }],
[ Prereqs => { 'Foo::Bar' => '1.234' } ],
[ Prereqs => RuntimeRecommends => { 'Foo::Bar::Opt' => '1.234' } ],
[ Prereqs => BuildRequires => { 'Test::Foo' => '2.34' } ],
[ Prereqs => ConfigureRequires => { 'Build::Foo' => '0.12' } ],
'MetaJSON',
[ MetaYAML => { version => 2 } ],
'MetaConfig',
),
},
},
);
$tzil->build;
my @files = map {; $_->name } @{ $tzil->files };
my %meta;
my $json = $tzil->slurp_file('build/META.json');
$meta{json} = JSON->new->decode($json);
my $yaml = $tzil->slurp_file('build/META.yml');
$meta{yaml} = YAML::Tiny->new->read_string($yaml)->[0];
is_deeply($meta{json}, $meta{yaml}, "META.json is_deeply META.yml");
for my $type (qw(json yaml)) {
my $meta = $meta{$type};
my %want = (
name => 'DZT-Sample',
abstract => 'Sample DZ Dist',
author => [ 'E. Xavier Ample <example@example.org>' ],
prereqs => {
runtime => {
requires => { 'Foo::Bar' => '1.234' },
recommends => { 'Foo::Bar::Opt' => '1.234' },
},
build => { requires => { 'Test::Foo' => '2.34' } },
configure => { requires => { 'Build::Foo' => '0.12' } },
},
license => [ 'perl_5' ],
resources => {
homepage => 'http://bana.na/phone',
license => [ 'http://b.sd/license' ],
},
version => '0.001',
);
for my $key (sort keys %want) {
is_deeply(
$meta->{ $key },
$want{ $key },
"$key is what we want in 2.0 $type",
);
}
}
}
{
# 1.4
my $tzil = Builder->from_config(
{ dist_root => 'corpus/dist/DZT' },
{
add_files => {
'source/dist.ini' => simple_ini(
'GatherDir',
[ MetaResources => HomePage => {homepage => 'http://bana.na/phone'}],
[ MetaResources => License => {license => 'http://b.sd/license' }],
[ Prereqs => { 'Foo::Bar' => '1.234' } ],
[ Prereqs => RuntimeRecommends => { 'Foo::Bar::Opt' => '1.234' } ],
[ Prereqs => BuildRequires => { 'Test::Foo' => '2.34' } ],
[ Prereqs => ConfigureRequires => { 'Build::Foo' => '0.12' } ],
[ MetaJSON => { version => 1.4 } ],
'MetaYAML',
'MetaConfig',
),
},
},
);
$tzil->build;
my @files = map {; $_->name } @{ $tzil->files };
my %meta;
my $json = $tzil->slurp_file('build/META.json');
$meta{json} = JSON->new->decode($json);
my $yaml = $tzil->slurp_file('build/META.yml');
$meta{yaml} = YAML::Tiny->new->read_string($yaml)->[0];
is_deeply($meta{json}, $meta{yaml}, "META.json is_deeply META.yml");
for my $type (qw(json yaml)) {
my $meta = $meta{$type};
my %want = (
name => 'DZT-Sample',
abstract => 'Sample DZ Dist',
author => [ 'E. Xavier Ample <example@example.org>' ],
configure_requires => { 'Build::Foo' => '0.12' },
build_requires => { 'Test::Foo' => '2.34' },
requires => { 'Foo::Bar' => '1.234' },
recommends => { 'Foo::Bar::Opt' => '1.234' },
license => 'perl',
resources => {
homepage => 'http://bana.na/phone',
license => 'http://b.sd/license',
},
version => '0.001',
);
for my $key (sort keys %want) {
is_deeply(
$meta->{ $key },
$want{ $key },
"$key is what we want in 1.4 $type",
);
}
}
}
done_testing;
|