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