This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
t/porting/checkcase.t should find() from the top level, not from '..'
[perl5.git] / t / porting / checkcase.t
1 #!/usr/bin/perl
2 # Finds the files that have the same name, case insensitively in the build tree
3
4 BEGIN {
5     @INC = '..' if -f '../TestInit.pm';
6 }
7 use TestInit qw(T); # T is chdir to the top level
8
9 use warnings;
10 use strict;
11 use File::Find;
12
13 my %files;
14 my $test_count = 0;
15
16 find(sub {
17            my $name = $File::Find::name;
18            # Assumes that the path separator is exactly one character.
19            $name =~ s/^\..//;
20
21            # Special exemption for Makefile, makefile
22            return if $name =~ m!\A(?:x2p/)?[Mm]akefile\z!;
23
24            push @{$files{lc $name}}, $name;
25          }, '.');
26
27 foreach (sort values %files) {
28     if (@$_ > 1) {
29                 print "not ok ".++$test_count. " - ". join(", ", @$_), "\n";
30                 print STDERR "# $_\n" foreach @$_;
31     } else {
32                 print "ok ".++$test_count. " - ". join(", ", @$_), "\n";
33         }
34 }
35
36 print "1..".$test_count."\n";