This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
A new test by Abigail: Check that certain modules don't
[perl5.git] / t / lib / no_load.t
CommitLineData
88431378
RGS
1#!./perl
2#
3# Check that certain modules don't get loaded when other modules are used.
4#
5
6BEGIN {
7 chdir 't' if -d 't';
8 @INC = qw(. ../lib);
9}
10
11use strict;
12use warnings;
13
14require "test.pl";
15
16#
17# Format: [Module-that-should-not-be-loaded => modules to test]
18#
19my @TESTS = (
20 [Carp => qw [warnings Exporter]],
21);
22
23my $count = 0;
24$count += @$_ - 1 for @TESTS;
25
26print "1..$count\n";
27
28foreach my $test (@TESTS) {
29 my ($exclude, @modules) = @$test;
30
31 foreach my $module (@modules) {
32 my $prog = <<" --";
33 use $module;
34 print exists \$INC {'$exclude.pm'} ? "not ok" : "ok";
35 --
36 fresh_perl_is ($prog, "ok", "", "$module does not load $exclude");
37 }
38}
39
40
41__END__