doy / spreadsheet-parsexlsx

parse XLSX files
http://metacpan.org/release/Spreadsheet-ParseXLSX
27 stars 35 forks source link

Test t/encryption.t fails on Windows #60

Closed marks6i closed 8 years ago

marks6i commented 8 years ago

Using Strawberry Perl 5.22.1, installing version 0.24 fails in t/encryption.t with:

not well-formed (invalid token) at line 2, column 1148, byte 1204 at C:/Strawberry/perl/vendor/lib/XML/Parser.pm line 187. at C:\Users\MARK~1.SOL\.cpanm\work\1468514556.9484\Spreadsheet-ParseXLSX-0.24\blib\lib/Spreadsheet/ParseXLSX/Decryptor.pm line 141. # Tests were run but no plan was declared and done_testing() was not seen. # Looks like your test exited with 255 just after 2. t/encryption.t ............. Dubious, test returned 255 (wstat 65280, 0xff00) All 2 subtests passed

This is caused, on Windows platforms, because slurping binary files works differently than on other platforms. In t/encryption.t, the two tests slurp the file into a string as part of the test but this is done (on the Windows platform) in a text, not binary mode.

Changing the slurp to use binary mode solves this problem. For example the 2 lines in t/encryption.t like:

do { open my $fh, '<', $filename or die; local $/; my $d = <$fh>; \$d },

can be re-written as:

do { open my $fh, '< :raw :bytes', $filename or die; local $/; my $d = <$fh>; \$d },

These changes will allow the tests to pass and should be universal to all platforms.

doy commented 8 years ago

Fixed in 0.25, thanks!