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 76 77 78 79 80 81 82 83
|
use strict;
use warnings;
use FindBin;
use lib "$FindBin::Bin/../../";
use Test::More;
use t::Util;
plan skip_all => "requires \$ENV{PERL_PRNQL_TEST_NETWORK} to test" unless $ENV{PERL_PRNQL_TEST_NETWORK};
plan skip_all => "requires CPAN::Common::Index" unless eval "require CPAN::Common::Index";
test_app('exclude submodules', sub {
my $tmpdir = shift;
test_file("$tmpdir/MyTest.pm", <<'END');
use strict;
use warnings;
use Acme::CPANAuthors;
use Acme::CPANAuthors::Utils;
END
}, {use_index => "Mirror"}, { runtime => { requires => { strict => 0, warnings => 0, 'Acme::CPANAuthors' => 0 }}});
test_app('modules under different namespaces that belong to the same distribution', sub {
my $tmpdir = shift;
test_file("$tmpdir/MyTest.pm", <<'END');
use Mojo::Base;
END
test_file("$tmpdir/MyTest2.pm", <<'END');
use Mojolicious;
END
}, {use_index => "Mirror"}, { runtime => { requires => { 'Mojolicious' => 0 }}});
test_app('modules under different namespaces that belong to the same distribution without a main module', sub {
my $tmpdir = shift;
test_file("$tmpdir/MyTest.pm", <<'END');
use LWP::UserAgent;
END
test_file("$tmpdir/MyTest2.pm", <<'END');
use LWP::Simple;
END
}, {use_index => "Mirror"}, { runtime => { requires => { 'LWP::Simple' => 0 }}});
test_app('modules under different namespaces (same depth) that belong to the same distribution', sub {
my $tmpdir = shift;
test_file("$tmpdir/MyTest.pm", <<'END');
use Mojo::Base;
END
test_file("$tmpdir/MyTest2.pm", <<'END');
use Mojolicious::Lite;
END
}, {use_index => "Mirror"}, { runtime => { requires => { 'Mojolicious' => 0 }}});
test_app('versioned modules', sub {
my $tmpdir = shift;
test_file("$tmpdir/MyTest.pm", <<'END');
use Mojo::Base 7.00;
END
test_file("$tmpdir/MyTest2.pm", <<'END');
use Mojolicious::Lite 8.00;
END
}, {use_index => "Mirror"}, { runtime => { requires => { 'Mojo::Base' => '7.00', 'Mojolicious::Lite' => '8.00' }}});
test_app('versioned module plus unversioned', sub {
my $tmpdir = shift;
test_file("$tmpdir/MyTest.pm", <<'END');
use Mojo::Base;
END
test_file("$tmpdir/MyTest2.pm", <<'END');
use Mojolicious::Lite 8.00;
END
}, {use_index => "Mirror"}, { runtime => { requires => { 'Mojolicious::Lite' => '8.00' }}});
done_testing;
|