From fade8559c4dc89cc048a557ce297af55b259e8de Mon Sep 17 00:00:00 2001 From: =?utf8?q?=C3=86var=20Arnfj=C3=B6r=C3=B0=20Bjarmason?= Date: Fri, 20 Jul 2007 00:05:45 +0000 Subject: [PATCH] Report the lines win32 newlines are found at --- t/maint/unix-newlines.t | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/t/maint/unix-newlines.t b/t/maint/unix-newlines.t index 8a85a3d1e6..c47dd17cdb 100644 --- a/t/maint/unix-newlines.t +++ b/t/maint/unix-newlines.t @@ -5,23 +5,28 @@ use warnings; use Test::More;; use File::Find; -use File::Slurp qw< slurp >; -use Socket qw< $CRLF $LF >; +use Socket '$CRLF'; my $ext = qr/(?: t | pm | sql | js | php | inc | xml )/x; my @files; find( sub { push @files, $File::Find::name if -f && /\. $ext $/x }, '.' ); -plan tests => scalar @files; +plan 'no_plan'; for my $file (@files) { - my $cont = slurp $file; - if ( $cont and $cont =~ $CRLF ) { - pass "$file contains windows newlines"; - } else { - fail "$file is made of unix newlines and win"; - } + open my $fh, "<", $file or die "Can't open $file: $!"; + binmode $fh; + + my $ok = 1; + while (<$fh>) { + if (/$CRLF/) { + fail "$file has \\r\\n on line $."; + $ok = 0; + } + } + + pass "$file has only unix newlines" if $ok; } -- 2.20.1