4 # See "Writing a test" in perlhack.pod for the instructions about the order that
5 # testing directories run, and which constructions should be avoided in the
8 # This regression tests ensures that the rules aren't accidentally overlooked.
14 open my $fh, '<', '../MANIFEST' or die "Can't open MANIFEST: $!";
16 # Three tests in t/comp need to use require or use to get their job done:
17 my %exceptions = (hints => "require './test.pl'",
18 parser => 'use DieDieDie',
19 proto => 'use strict',
22 while (my $file = <$fh>) {
23 next unless $file =~ s!^t/!!;
26 next unless $file =~ m!\.t$!;
29 open my $t, '<', $file or die "Can't open $file: $!";
31 # Make sure that we don't match ourselves
32 unlike($contents, qr/use\s+Test::More/, "$file doesn't use Test::\QMore");
33 next unless $file =~ m!^base/! or $file =~ m!^comp!;
35 # Remove only the excepted constructions for the specific files.
36 if ($file =~ m!comp/(.*)\.t! && $exceptions{$1}) {
37 my $allowed = $exceptions{$1};
38 $contents =~ s/\Q$allowed//gs;
41 # All uses of use are allowed in t/comp/use.t
42 unlike($contents, qr/^\s*use\s+/m, "$file doesn't use use")
43 unless $file eq 'comp/use.t';
44 # All uses of require are allowed in t/comp/require.t
45 unlike($contents, qr/^\s*require\s+/m, "$file doesn't use require")
46 unless $file eq 'comp/require.t'