Index: trunk/phase3/t/maint/unix-newlines.t |
— | — | @@ -5,23 +5,28 @@ |
6 | 6 | use Test::More;; |
7 | 7 | |
8 | 8 | use File::Find; |
9 | | -use File::Slurp qw< slurp >; |
10 | | -use Socket qw< $CRLF $LF >; |
| 9 | +use Socket '$CRLF'; |
11 | 10 | |
12 | 11 | my $ext = qr/(?: t | pm | sql | js | php | inc | xml )/x; |
13 | 12 | |
14 | 13 | my @files; |
15 | 14 | find( sub { push @files, $File::Find::name if -f && /\. $ext $/x }, '.' ); |
16 | 15 | |
17 | | -plan tests => scalar @files; |
| 16 | +plan 'no_plan'; |
18 | 17 | |
19 | 18 | for my $file (@files) { |
20 | | - my $cont = slurp $file; |
21 | | - if ( $cont and $cont =~ $CRLF ) { |
22 | | - pass "$file contains windows newlines"; |
23 | | - } else { |
24 | | - fail "$file is made of unix newlines and win"; |
25 | | - } |
| 19 | + open my $fh, "<", $file or die "Can't open $file: $!"; |
| 20 | + binmode $fh; |
| 21 | + |
| 22 | + my $ok = 1; |
| 23 | + while (<$fh>) { |
| 24 | + if (/$CRLF/) { |
| 25 | + fail "$file has \\r\\n on line $."; |
| 26 | + $ok = 0; |
| 27 | + } |
| 28 | + } |
| 29 | + |
| 30 | + pass "$file has only unix newlines" if $ok; |
26 | 31 | } |
27 | 32 | |
28 | 33 | |
Property changes on: . |
___________________________________________________________________ |
Modified: svk:merge |
29 | 34 | - 27bc04cf-33ed-4153-9a14-f265503a8842:/local/mediawiki:61202 |
7cf7ea9e-0fb0-4aec-bfeb-b705e7e456c6:/local/mediawiki:61660 |
30 | 35 | + 27bc04cf-33ed-4153-9a14-f265503a8842:/local/mediawiki:61330 |
7cf7ea9e-0fb0-4aec-bfeb-b705e7e456c6:/local/mediawiki:61660 |