3 plan skip_all => <<'END_HELP' unless $ENV{MOO_TEST_MD};
4 This test will not run unless you set MOO_TEST_MD to a true value.
8 all Test every dist which depends on Moose except those
9 that we know cannot be tested. This is a lot of
12 Dist::1,Dist::2,... Test the individual dists listed.
14 MooX Test all Moo extension distros.
16 1 Run the default tests. We pick 200 random dists and
21 use Test::DependentModules qw( test_modules );
25 my $mcpan = MetaCPAN::API->new;
26 my $res = $mcpan->post(
27 '/search/reverse_dependencies/Moo' => {
30 query => { "match_all" => {} },
33 { term => { 'release.status' => 'latest' } },
34 { term => { 'release.authorized' => \1 } },
40 fields => ['distribution', 'provides'],
45 foreach my $line (<DATA>) {
47 if ($line =~ /^\s*(\S+)\s*(#|$)/) {
51 die "Invalid entry in DATA section: $line";
55 my @modules = sort grep !/^(?:Task|Bundle|Acme)::/, grep !$bad_module{$_}, map {
56 if (my $provides = $_->{fields}{provides}) {
57 ref $provides ? (sort @$provides)[0] : $provides;
60 my $dist = $_->{fields}{distribution};
64 } @{ $res->{hits}{hits} };
66 if ( $ENV{MOO_TEST_MD} eq 'MooX' ) {
67 @modules = grep /^MooX(?:$|::)/, @modules;
69 elsif ( $ENV{MOO_TEST_MD} eq '1' ) {
71 Picking 200 random dependents to test. Set MOO_TEST_MD=all to test all
72 dependents or MOO_TEST_MD=MooX to test extension modules only.
74 @modules = (List::Util::shuffle(@modules))[0..199];
76 elsif ( $ENV{MOO_TEST_MD} ne 'all' ) {
77 my @chosen = split /,/, $ENV{MOO_TEST_MD};
78 my %modules = map { $_ => 1 } @modules;
79 if (my @unknown = grep { !$modules{$_} } @chosen) {
80 die "Unknown modules: @unknown";
85 plan tests => scalar @modules;
86 test_modules(@modules);