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
|
use strict;
use warnings;
use Test::More 0.96;
use if $ENV{AUTHOR_TESTING}, 'Test::Warnings';
use Test::DZil;
use Path::Tiny;
use Test::Fatal;
{
my $tzil = Builder->from_config(
{ dist_root => 'does-not-exist' },
{
add_files => {
path(qw(source dist.ini)) => simple_ini(
'GatherDir',
'MakeMaker',
'MakeMaker::Awesome',
),
path(qw(source lib DZT Sample.pm)) => 'package DZT::Sample; 1',
},
},
);
$tzil->chrome->logger->set_debug(1);
like(
exception { $tzil->build },
qr/\QYou can't use [MakeMaker] and [MakeMaker::Awesome] at the same time!\E/,
'multiple MakeMakers results in a build error',
);
diag 'got log messages: ', explain $tzil->log_messages
if not Test::Builder->new->is_passing;
}
{
package my::MakeMaker;
our @ISA = 'Dist::Zilla::Plugin::MakeMaker';
}
{
package my::MakeMaker::Awesome;
our @ISA = 'Dist::Zilla::Plugin::MakeMaker::Awesome';
}
{
my $tzil = Builder->from_config(
{ dist_root => 'does-not-exist' },
{
add_files => {
path(qw(source dist.ini)) => simple_ini(
'GatherDir',
'=my::MakeMaker',
'=my::MakeMaker::Awesome',
'MakeMaker',
),
path(qw(source lib DZT Sample.pm)) => 'package DZT::Sample; 1',
},
},
);
$tzil->chrome->logger->set_debug(1);
like(
exception { $tzil->build },
qr/\QYou can't use my::MakeMaker, my::MakeMaker::Awesome and [MakeMaker] at the same time!\E/,
'error message is sane with >2 plugins and a different prefix',
);
diag 'got log messages: ', explain $tzil->log_messages
if not Test::Builder->new->is_passing;
}
done_testing;
|