xref: /openbsd-src/gnu/usr.bin/perl/t/porting/checkcase.t (revision d13be5d47e4149db2549a9828e244d59dbc43f15)
1#!/usr/bin/perl
2# Finds the files that have the same name, case insensitively,
3# in the current directory and its subdirectories
4
5use warnings;
6use strict;
7use File::Find;
8
9my %files;
10my $test_count = 0;
11
12find(sub {
13	   my $name = $File::Find::name;
14	   # Assumes that the path separator is exactly one character.
15	   $name =~ s/^\.\..//;
16
17	   # Special exemption for Makefile, makefile
18	   return if $name =~ m!\A(?:x2p/)?[Mm]akefile\z!;
19
20	   push @{$files{lc $name}}, $name;
21	 }, '..');
22
23foreach (values %files) {
24    if (@$_ > 1) {
25		print "not ok ".++$test_count. " - ". join(", ", @$_), "\n";
26    } else {
27		print "ok ".++$test_count. " - ". join(", ", @$_), "\n";
28	}
29}
30
31print "1..".$test_count."\n";
32