Flipped checkcase.pl from a porting tool to an actual test file
[p5sagit/p5-mst-13.2.git] / t / porting / checkcase.t
1 #!/usr/bin/perl
2 # Finds the files that have the same name, case insensitively,
3 # in the current directory and its subdirectories
4
5 BEGIN {
6     chdir 't' if -d 't';
7     @INC = '../lib';
8 }
9
10
11
12 use warnings;
13 use strict;
14 use File::Find;
15
16 my %files;
17 my $test_count = 0;
18
19 find(sub {
20            my $name = $File::Find::name;
21            # Assumes that the path separator is exactly one character.
22            $name =~ s/^\.\..//;
23            push @{$files{lc $name}}, $name;
24          }, '.');
25
26 my $failed;
27
28 foreach (values %files) {
29     if (@$_ > 1) {
30                 print "not ok ".++$test_count. " - ". join(", ", @$_), "\n";
31     } else {
32                 print "ok ".++$test_count. " - ". join(", ", @$_), "\n";
33         }
34 }
35
36 print "1..".$test_count."\n";