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
|
use strict;
use warnings;
use FindBin;
use lib "$FindBin::Bin/../../";
use Test::More;
use t::Util;
test_bin('also scan extlib', sub {
my $tmpdir = shift;
test_file("$tmpdir/MyTest.pm", <<'END');
use strict;
use warnings;
use Foo;
END
test_file("$tmpdir/extlib/MyTest2.pm", <<'END');
use strict;
use warnings;
use Bar;
END
}, [qw/--scan-also extlib/], <<'CPANFILE');
requires 'Bar';
requires 'Foo';
requires 'strict';
requires 'warnings';
CPANFILE
test_bin('also and local', sub {
my $tmpdir = shift;
test_file("$tmpdir/MyTest.pm", <<'END');
use strict;
use warnings;
use Foo; # --scan-also makes this a local module
END
test_file("$tmpdir/extlib/Foo.pm", <<'END');
use strict;
use warnings;
use Bar;
END
}, [qw/--also extlib/], <<'CPANFILE');
requires 'Bar';
requires 'strict';
requires 'warnings';
CPANFILE
test_bin('also and test files', sub {
my $tmpdir = shift;
test_file("$tmpdir/MyTest.pm", <<'END');
use strict;
use warnings;
use Foo; # t/Foo.pm is not a local file
END
test_file("$tmpdir/extlib/Foo/t/load.t", <<'END');
use strict;
use warnings;
use Test::More;
END
# this is not used from .t files and thus ignored
test_file("$tmpdir/extlib/Foo/t/Foo.pm", <<'END');
use strict;
use warnings;
use Bar;
END
}, [qw/--scan-also extlib/], <<'CPANFILE');
requires 'Foo';
requires 'strict';
requires 'warnings';
on test => sub {
requires 'Test::More';
requires 'strict';
requires 'warnings';
};
CPANFILE
done_testing;
|