This repository has been archived by the owner on Dec 28, 2023. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added OLE file checking to identify xlsx and encrypted files.
- Loading branch information
Showing
20 changed files
with
364 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
{ | ||
"caption" : "Test error handling.", | ||
"description" : "Returns a zip error when not a valid zip file.", | ||
"description" : "Returns a error if the file is an xls file.", | ||
"xlsx_file" : "error02.xlsx", | ||
"expected" : { | ||
"error_code" : 2, | ||
"error_text" : "File has zip error. format error: can\'t find EOCD signature " | ||
"error_text" : "File is xls not xlsx: t/regression/xlsx_files/error02.xlsx" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"caption" : "Test error handling.", | ||
"description" : "Returns an error when the file is encrypted xlsx.", | ||
"xlsx_file" : "error03.xlsx", | ||
"expected" : { | ||
"error_code" : 3, | ||
"error_text" : "File is encrypted xlsx: t/regression/xlsx_files/error03.xlsx" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"caption" : "Test error handling.", | ||
"description" : "Returns a error if the file is an unknown OLE doc.", | ||
"xlsx_file" : "error04.xlsx", | ||
"expected" : { | ||
"error_code" : 4, | ||
"error_text" : "File is unknown OLE doc type: t/regression/xlsx_files/error04.xlsx" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"caption" : "Test error handling.", | ||
"description" : "Returns a zip error when not a valid zip file.", | ||
"xlsx_file" : "error05.xlsx", | ||
"expected" : { | ||
"error_code" : 5, | ||
"error_text" : "File has zip error: format error: can\'t find EOCD signature " | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"caption" : "Test error handling.", | ||
"description" : "Returns an error when a subfile is missing.", | ||
"xlsx_file" : "error06.xlsx", | ||
"expected" : { | ||
"error_code" : 6, | ||
"error_text" : "File missing subfile: docProps/core.xml" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
############################################################################### | ||
# | ||
# Tests for Excel::Writer::XLSX. | ||
# | ||
# reverse('©'), February 2012, John McNamara, jmcnamara@cpan.org | ||
# | ||
|
||
use lib 't/lib'; | ||
use TestFunctions qw(_is_deep_diff _read_json); | ||
use strict; | ||
use warnings; | ||
use Excel::Reader::XLSX; | ||
|
||
use Test::More tests => 1; | ||
|
||
############################################################################### | ||
# | ||
# Test setup. | ||
# | ||
my $json_filename = 't/regression/json_files/read_error03.json'; | ||
my $json = _read_json( $json_filename ); | ||
my $caption = $json->{caption}; | ||
my $expected = $json->{expected}; | ||
my $xlsx_file = 't/regression/xlsx_files/' . $json->{xlsx_file}; | ||
my $got; | ||
|
||
|
||
############################################################################### | ||
# | ||
# Test error handling when reading data from an Excel file. | ||
# | ||
use Excel::Reader::XLSX; | ||
|
||
my $reader = Excel::Reader::XLSX->new(); | ||
my $workbook = $reader->read_file( $xlsx_file ); | ||
|
||
$got = { | ||
error_code => $reader->error_code(), | ||
error_text => $reader->error(), | ||
}; | ||
|
||
# Test the results. | ||
_is_deep_diff( $got, $expected, $caption ); |
Oops, something went wrong.