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 151 152 153 154 155 156 157 158
|
use strict;
use warnings;
use Test::More 0.88;
use if $ENV{AUTHOR_TESTING}, 'Test::Warnings';
use Test::Deep;
use Test::DZil;
use Path::Tiny;
use File::pushd 'pushd';
{
my $tzil = Builder->from_config(
{ dist_root => 'does-not-exist' },
{
add_files => {
path(qw(source dist.ini)) => simple_ini(
{ # merge into root section
author => [
'Anon Y. Moose <anon@null.com>',
'Anne O\'Thor <anne@cpan.org',
],
},
'GatherDir',
[ Prereqs => { perl => 5.016 } ], # must be before MMA
'MakeMaker::Awesome',
),
},
},
);
$tzil->chrome->logger->set_debug(1);
$tzil->build;
like(
$tzil->slurp_file('build/Makefile.PL'),
qr/^\s*['"]AUTHOR['"]\s*=>\s*\[\s*[^]]+\],/m,
'AUTHOR generated as a listref, when perl version already accomodates the ExtUtils::MakeMaker version',
);
cmp_deeply(
$tzil->distmeta,
superhashof({
prereqs => {
configure => {
requires => {
'ExtUtils::MakeMaker' => '6.5702',
},
},
runtime => {
requires => {
perl => '5.016',
},
},
},
}),
'minimum EUMM version is set accordingly',
)
or diag 'got distmeta: ', explain $tzil->distmeta;
diag 'got log messages: ', explain $tzil->log_messages
if not Test::Builder->new->is_passing;
}
{
my $tzil = Builder->from_config(
{ dist_root => 'does-not-exist' },
{
add_files => {
path(qw(source dist.ini)) => simple_ini(
{ # merge into root section
author => [
'Anon Y. Moose <anon@null.com>',
'Anne O\'Thor <anne@cpan.org',
],
},
'GatherDir',
[ 'MakeMaker::Awesome' => { eumm_version => '6.68' } ],
),
},
},
);
$tzil->chrome->logger->set_debug(1);
$tzil->build;
like(
$tzil->slurp_file('build/Makefile.PL'),
qr/^\s*['"]AUTHOR['"]\s*=>\s*\[\s*[^]]+\],/m,
'AUTHOR generated as a listref, when eumm_version already accomodates the requirement',
);
cmp_deeply(
$tzil->distmeta,
superhashof({
prereqs => {
configure => {
requires => {
'ExtUtils::MakeMaker' => '6.68',
},
},
},
}),
'ExtUtils::MakeMaker prereq matches eumm_version',
)
or diag 'got distmeta: ', explain $tzil->distmeta;
diag 'got log messages: ', explain $tzil->log_messages
if not Test::Builder->new->is_passing;
}
{
my $tzil = Builder->from_config(
{ dist_root => 'does-not-exist' },
{
add_files => {
path(qw(source dist.ini)) => simple_ini(
{ # merge into root section
author => [
'Anon Y. Moose <anon@null.com>',
'Anne O\'Thor <anne@cpan.org',
],
},
'GatherDir',
'MakeMaker::Awesome',
),
},
},
);
$tzil->chrome->logger->set_debug(1);
$tzil->build;
like(
$tzil->slurp_file('build/Makefile.PL'),
qr/^\s*['"]AUTHOR['"]\s*=>\s*(['"]).+['"],/m,
'AUTHOR generated as string, not listref',
);
cmp_deeply(
$tzil->distmeta,
superhashof({
prereqs => {
configure => {
requires => {
'ExtUtils::MakeMaker' => '0',
},
},
},
}),
'minimum EUMM version is still zero, when we cannot justify raising it just for the listref AUTHOR feature',
)
or diag 'got distmeta: ', explain $tzil->distmeta;
diag 'got log messages: ', explain $tzil->log_messages
if not Test::Builder->new->is_passing;
}
done_testing;
|