Report the lines win32 newlines are found at
[lhc/web/wiklou.git] / t / maint / unix-newlines.t
1 #!/usr/bin/env perl
2 use strict;
3 use warnings;
4
5 use Test::More;;
6
7 use File::Find;
8 use Socket '$CRLF';
9
10 my $ext = qr/(?: t | pm | sql | js | php | inc | xml )/x;
11
12 my @files;
13 find( sub { push @files, $File::Find::name if -f && /\. $ext $/x }, '.' );
14
15 plan 'no_plan';
16
17 for my $file (@files) {
18 open my $fh, "<", $file or die "Can't open $file: $!";
19 binmode $fh;
20
21 my $ok = 1;
22 while (<$fh>) {
23 if (/$CRLF/) {
24 fail "$file has \\r\\n on line $.";
25 $ok = 0;
26 }
27 }
28
29 pass "$file has only unix newlines" if $ok;
30 }
31
32
33