summaryrefslogtreecommitdiff
path: root/excelize_test.go
diff options
context:
space:
mode:
authorxuri <xuri.me@gmail.com>2021-12-27 23:34:14 +0800
committerxuri <xuri.me@gmail.com>2021-12-27 23:49:28 +0800
commit89b85934f60ba0012f3de6da03eb12959e4b4b72 (patch)
tree3d913c2bdabf06b79b7c2f223cfe26b64aacd8cc /excelize_test.go
parent6b1e592cbc7b1412da5f6d0badeaf1083117c762 (diff)
This closes #1096, memory usage optimization and another 4 changes
- Unzip shared string table to system temporary file when large inner XML, reduce memory usage about 70% - Remove unnecessary exported variable `XMLHeader`, we can using `encoding/xml` package's `xml.Header` instead of it - Using constant instead of inline text for default XML path - Rename exported option field `WorksheetUnzipMemLimit` to `UnzipXMLSizeLimit` - Unit test and documentation updated
Diffstat (limited to 'excelize_test.go')
-rw-r--r--excelize_test.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/excelize_test.go b/excelize_test.go
index 4c136b6..9aaaae9 100644
--- a/excelize_test.go
+++ b/excelize_test.go
@@ -201,7 +201,7 @@ func TestCharsetTranscoder(t *testing.T) {
func TestOpenReader(t *testing.T) {
_, err := OpenReader(strings.NewReader(""))
assert.EqualError(t, err, "zip: not a valid zip file")
- _, err = OpenReader(bytes.NewReader(oleIdentifier), Options{Password: "password", WorksheetUnzipMemLimit: UnzipSizeLimit + 1})
+ _, err = OpenReader(bytes.NewReader(oleIdentifier), Options{Password: "password", UnzipXMLSizeLimit: UnzipSizeLimit + 1})
assert.EqualError(t, err, "decrypted file failed")
// Test open spreadsheet with unzip size limit.
@@ -225,7 +225,7 @@ func TestOpenReader(t *testing.T) {
assert.NoError(t, f.Close())
// Test open spreadsheet with invalid optioins.
- _, err = OpenReader(bytes.NewReader(oleIdentifier), Options{UnzipSizeLimit: 1, WorksheetUnzipMemLimit: 2})
+ _, err = OpenReader(bytes.NewReader(oleIdentifier), Options{UnzipSizeLimit: 1, UnzipXMLSizeLimit: 2})
assert.EqualError(t, err, ErrOptionsUnzipSizeLimit.Error())
// Test unexpected EOF.
@@ -1208,7 +1208,7 @@ func TestContentTypesReader(t *testing.T) {
// Test unsupported charset.
f := NewFile()
f.ContentTypes = nil
- f.Pkg.Store("[Content_Types].xml", MacintoshCyrillicCharset)
+ f.Pkg.Store(defaultXMLPathContentTypes, MacintoshCyrillicCharset)
f.contentTypesReader()
}
@@ -1216,7 +1216,7 @@ func TestWorkbookReader(t *testing.T) {
// Test unsupported charset.
f := NewFile()
f.WorkBook = nil
- f.Pkg.Store("xl/workbook.xml", MacintoshCyrillicCharset)
+ f.Pkg.Store(defaultXMLPathWorkbook, MacintoshCyrillicCharset)
f.workbookReader()
}