From: Peter Rabbitson Date: Wed, 4 Jan 2012 06:15:43 +0000 (+0100) Subject: No longer blindly assume utf8 on input files (RT#59877) X-Git-Tag: 1.0~2 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FTest-EOL.git;a=commitdiff_plain;h=a2bfe7c3259a853708ab9ce6224d35b1a011fc31 No longer blindly assume utf8 on input files (RT#59877) --- diff --git a/Changes b/Changes index 33305e8..979a902 100644 --- a/Changes +++ b/Changes @@ -2,6 +2,7 @@ Revision history for Test-EOL - Fix misleading test failure diagnostics when only issue are trailing whitespaces + - No longer blindly assume utf8 on input files (RT#59877) 0.9 2010-06-16 - Fix warnings on very old perls (paul@city-fan.org) diff --git a/lib/Test/EOL.pm b/lib/Test/EOL.pm index 1b5b8c4..7666fd5 100644 --- a/lib/Test/EOL.pm +++ b/lib/Test/EOL.pm @@ -98,7 +98,7 @@ sub eol_unix_ok { open my $fh, $file or do { $Test->ok(0, $test_txt); $Test->diag("Could not open $file: $!"); return; }; # Windows-- , default is :crlf, which hides \r\n -_- - binmode( $fh, ':raw:utf8' ); + binmode( $fh, ':raw' ); my $line = 0; my @fails; while (<$fh>) { diff --git a/t/13-latin1.t b/t/13-latin1.t new file mode 100644 index 0000000..62fd6c6 --- /dev/null +++ b/t/13-latin1.t @@ -0,0 +1,30 @@ +use strict; +use warnings; + +use Test::More tests => 2; +use File::Temp qw( tempdir tempfile ); + +use Config; +$ENV{PERL5LIB} = join ($Config{path_sep}, @INC); + +{ + my $tmpdir = tempdir( CLEANUP => 1 ); + my ($fh, $filename) = tempfile( DIR => $tmpdir, SUFFIX => '.pL' ); + print $fh "\xE1\xF3 how na\xEFve"; + close $fh; + + my (undef, $outfile) = tempfile(); + + `$^X -MTest::EOL -e "all_perl_files_ok( '$tmpdir' )" >$outfile 2>&1`; + ok(! $? ); + + my $out = do { local (@ARGV, $/) = $outfile; <> }; + + is ( + $out, + "ok 1 - No incorrect line endings in '$filename'\n1..1\n", + 'no malformed unicode warnings', + ); + + unlink $outfile; +}