diff --git a/Changes b/Changes index e278704..9655e80 100644 --- a/Changes +++ b/Changes @@ -2,7 +2,7 @@ Revision history for Perl extension WWW-PGXN. 0.13.0 2024-02-17T19:54:17Z - Added CI tests for Perls 5.10 - 5.38 on Linux, macOS, and Windows. - - Fixed issues that caused test failures on Windows. + - Fixed failures caused by line endings on Windows. - Updated relevant URLs from http to https. 0.12.4 2013-11-06T05:56:15Z diff --git a/lib/WWW/PGXN.pm b/lib/WWW/PGXN.pm index 222e5ac..2379b7d 100644 --- a/lib/WWW/PGXN.pm +++ b/lib/WWW/PGXN.pm @@ -250,7 +250,7 @@ sub get { headers => {}, } unless -e $file; - open my $fh, '<:raw:crlf', $file or return { + open my $fh, '<:raw', $file or return { success => 0, status => 500, reason => $!, diff --git a/t/base.t b/t/base.t index 626b980..b35b57d 100644 --- a/t/base.t +++ b/t/base.t @@ -145,12 +145,16 @@ is $pgxn->html_doc_path_for('pair', '0.1.2', 'doc/foo'), ############################################################################## # Test spec fetching. +my $windows = $^O =~ /^Win/; ok my $spec = $pgxn->spec, 'Get spec'; +$spec =~ s/\r\n/\n/g if $windows; like $spec, qr{PGXN Meta Spec - The PGXN distribution metadatå specification$}m, 'It should look like the text file'; ok $spec = $pgxn->spec('txt'), 'Get text spec'; +$spec =~ s/\r\n/\n/g if $windows; like $spec, qr{PGXN Meta Spec - The PGXN distribution metadatå specification$}m, 'It should look like the text file'; ok $spec = $pgxn->spec('html'), 'Get HTML spec'; +$spec =~ s/\r\n/\n/g if $windows; like $spec, qr{

PGXN Meta Spec - The PGXN distribution metadatå specification

$}m, 'It should look like the HTML file'; diff --git a/t/dist.t b/t/dist.t index 71e29ae..a3b7006 100644 --- a/t/dist.t +++ b/t/dist.t @@ -137,6 +137,8 @@ is_deeply $dist->docs, { ok my $doc = $dist->body_for_html_doc('README'), 'Fetch the README body'; +my $windows = $^O =~ /^Win/; +$doc =~ s/\r\n/\n/g if $windows; # Contents should be the decoded HTML. is $doc, do { @@ -149,6 +151,7 @@ is $doc, do { # Do the same for the doc. ok $doc = $dist->body_for_html_doc('doc/pair'), 'Fetch the doc/pair body'; +$doc =~ s/\r\n/\n/g if $windows; is $doc, do { my $fn = catfile qw(t mirror dist pair 0.1.1 doc pair.html); open my $fh, '<:encoding(utf-8)', $fn or die "Cannot open $fn: $!\n";