This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Make utf8::encode respect magic
[perl5.git] / t / porting / checkcase.t
CommitLineData
772ab650 1#!/usr/bin/perl
e8d4f2e1
NC
2# Finds the files that have the same name, case insensitively in the build tree
3
4BEGIN {
5 @INC = '..' if -f '../TestInit.pm';
f986e774 6 require './test.pl';
e8d4f2e1
NC
7}
8use TestInit qw(T); # T is chdir to the top level
772ab650
JM
9
10use warnings;
11use strict;
12use File::Find;
13
14my %files;
bf61c852
JV
15my $test_count = 0;
16
b31a8a8d 17find({no_chdir => 1, wanted => sub {
5d52f905
RS
18 my $name = $File::Find::name;
19 # Assumes that the path separator is exactly one character.
e8d4f2e1 20 $name =~ s/^\..//;
f86fc3ff 21
5d52f905
RS
22 # Special exemption for Makefile, makefile
23 return if $name =~ m!\A(?:x2p/)?[Mm]akefile\z!;
0a38ae18 24
94c4b1f7
NC
25 if ($name eq '.git') {
26 # Don't scan the .git directory, as its contents are outside
27 # our control. In particular, as fetch doesn't default to
28 # --prune, # someone pushing a branch upstream with a name
29 # which case-conflicts with a previously deleted branch will
30 # cause action-at-a-distance failures, because locally
31 # .git/logs/refs/remotes will contain both.
32 ++$File::Find::prune;
33 return;
34 }
35
5d52f905 36 push @{$files{lc $name}}, $name;
b31a8a8d 37 }}, '.');
772ab650 38
0f7807cd 39foreach (sort values %files) {
f986e774
CK
40 is( @$_, 1, join(", ", @$_) ) or
41 do{ note($_) foreach @$_; };
772ab650
JM
42}
43
f986e774 44done_testing();