NAME

Foo - Hello, this is foo

VERSION

version $version

POD

like($module, qr/^=head1 AUTHOR\n\n/m, 'module has woven the AUTHOR section into pod');

my ($testsub, $verb) = $testcase->{has_config_plugin}
    ? ( sub { goto &like }, 'has' )
    : ( sub { goto &unlike }, "hasn't" );
$testsub->(
    $module,
    qr/^=head1 CONTRIBUTOR\n\n.*Anon Y. Moose <anon\@null.com>\n\n/ms,
    "module $verb woven the CONTRIBUTOR section into pod",
);

cmp_deeply(
    $tzil->distmeta,
    superhashof({
        x_Dist_Zilla => superhashof({
            plugins => supersetof(
                {
                    class => 'Dist::Zilla::Plugin::PodWeaver',
                    config => superhashof({
                        'Dist::Zilla::Plugin::PodWeaver' => $testcase->{has_config_plugin}
                          ? (superhashof({
                                config_plugins => [ '@Author::ETHER' ],
                                # check that all plugins came from '@Author::ETHER'
                                plugins => array_each(
                                    # TODO: we can use our bundle name in these
                                    # sections too, by adjusting how we set up the configs
                                    code(sub {
                                        ref $_[0] eq 'HASH' or return (0, 'not a HASH');
                                        $_[0]->{name} =~ m{^\@(CorePrep|Author::ETHER)/}
                                            or $_[0]->{class} =~ /^Pod::Weaver::Section::(Generic|Collect)$/
                                            or return (0, 'weaver plugin has bad name');
                                        return 1;
                                    }),
                                ),
                            }))
                          : notexists('config_plugins'),
                    }),
                    name => 'PodWeaver',
                    version => Dist::Zilla::Plugin::PodWeaver->VERSION,
                },
            ),
        }),
    }),
    'weaver plugin config is properly included in metadata - config_plugin is always used by [PodWeaver], when provided'
)
or diag 'got distmeta: ', explain $tzil->distmeta;

diag 'got log messages: ', explain $tzil->log_messages
    if not Test::Builder->new->is_passing;
}
foreach @tests;

done_testing;