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
|
use strict;
use warnings;
use Test::More 0.88;
use Test::DZil;
use Test::Deep;
{
package Keywords; # see also Dist::Zilla::Plugin::Keywords ;)
use Moose;
with 'Dist::Zilla::Role::MetaProvider';
sub mvp_multivalue_args { qw(keywords) }
has keywords => (
is => 'ro', isa => 'ArrayRef[Str]',
lazy => 1,
default => sub { [] },
);
sub metadata
{
my $self = shift;
my $keywords = $self->keywords;
return { @$keywords ? ( keywords => $keywords ) : () };
}
}
{
my $tzil = Builder->from_config(
{ dist_root => 'corpus/dist/DZT' },
{
add_files => {
'source/dist.ini' => simple_ini(
[ '=Keywords' => 'plugin 1' => { keywords => [ qw(foo bar) ] } ],
[ '=Keywords' => 'plugin 2' => { keywords => [ qw(dog cat) ] } ],
),
},
},
);
cmp_deeply(
$tzil->distmeta,
{
abstract => 'Sample DZ Dist',
author => ['E. Xavier Ample <example@example.org>'],
dynamic_config => 0,
generated_by => ignore,
license => [ 'perl_5' ],
'meta-spec' => {
url => 'http://search.cpan.org/perldoc?CPAN::Meta::Spec',
version => 2
},
name => 'DZT-Sample',
release_status => 'stable',
version => '0.001',
keywords => [ qw(foo bar dog cat) ],
x_generated_by_perl => "$^V",
x_spdx_expression => 'Artistic-1.0-Perl OR GPL-1.0-or-later',
},
'metadata is correctly merged together',
);
}
done_testing;
|