use
if
$ENV
{AUTHOR_TESTING},
'Test::Warnings'
;
my
$tempdir
= no_git_tempdir();
my
$tzil
= Builder->from_config(
{
dist_root
=>
'does-not-exist'
},
{
tempdir_root
=>
$tempdir
->stringify,
add_files
=> {
path(
qw(source dist.ini)
) => simple_ini(
{
author
=>
'Anne O\'Thor <author@example.com>'
,
},
[
GatherDir
=> ],
[
MetaConfig
=> ],
[
'Git::Contributors'
],
),
path(
qw(source lib Foo.pm)
) =>
"package Foo;\n1;\n"
,
},
},
);
my
$root
= path(
$tzil
->tempdir)->child(
'source'
);
my
$git
= git_wrapper(
$root
);
my
$changes
=
$root
->child(
'Changes'
);
$changes
->spew(
"Release history for my dist\n\n"
);
$git
->add(
'Changes'
);
$git
->commit({
message
=>
'first commit'
,
author
=>
'Tomas Doran <t0m@bobtfish.org>'
});
$changes
->append(
"- a changelog entry\n"
);
$git
->add(
'Changes'
);
$git
->commit({
message
=>
'second commit'
,
author
=>
'Tomas Doran <bobtfish@cpan.org>'
});
$changes
->append(
"- a changelog entry\n"
);
$git
->add(
'Changes'
);
$git
->commit({
message
=>
'third commit'
,
author
=>
'Suzie Homemaker <suzie@cpan.org>'
});
$changes
->append(
"- a changelog entry\n"
);
$git
->add(
'Changes'
);
$git
->commit({
message
=>
'fourth commit'
,
author
=>
'Suzie Homemaker <me@suzie.org>'
});
$tzil
->chrome->logger->set_debug(1);
is(
exception {
$tzil
->build },
undef
,
'build proceeds normally'
,
);
cmp_deeply(
$tzil
->distmeta,
superhashof({
x_contributors
=> [
'Suzie Homemaker <me@suzie.org>'
,
'Suzie Homemaker <suzie@cpan.org>'
,
'Tomas Doran <bobtfish@cpan.org>'
,
'Tomas Doran <t0m@bobtfish.org>'
,
],
x_Dist_Zilla
=> superhashof({
plugins
=> supersetof(
{
class
=>
'Dist::Zilla::Plugin::Git::Contributors'
,
config
=> {
'Dist::Zilla::Plugin::Git::Contributors'
=> superhashof({
include_authors
=> 0,
include_releaser
=> 1,
}),
},
name
=>
'Git::Contributors'
,
version
=> Dist::Zilla::Plugin::Git::Contributors->VERSION,
},
),
}),
}),
'duplicate contributor names are resolved'
,
) or diag
'got distmeta: '
, explain
$tzil
->distmeta;
cmp_deeply(
$tzil
->log_messages,
superbagof(
re(
qr/^\[Git::Contributors\] multiple emails with the same name found/
),
),
'got a warning about duplicate names'
,
);
diag
'got log messages: '
, explain
$tzil
->log_messages
if
not Test::Builder->new->is_passing;
done_testing;