diff options
author | xuri <xuri.me@gmail.com> | 2022-11-13 00:40:04 +0800 |
---|---|---|
committer | xuri <xuri.me@gmail.com> | 2022-11-13 00:40:04 +0800 |
commit | ac564afa56a691e378ab9bb04cb14bb283886a16 (patch) | |
tree | def0303fd88e78897a3c739c31c89cff8f492d43 /file_test.go | |
parent | bd5dd17673f767b9f4643423c77eec486f2ad53f (diff) |
Remove internal error log print, throw XML deserialize error
Diffstat (limited to 'file_test.go')
-rw-r--r-- | file_test.go | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/file_test.go b/file_test.go index 83a9b78..4272a7b 100644 --- a/file_test.go +++ b/file_test.go @@ -4,6 +4,7 @@ import ( "bufio" "bytes" "os" + "path/filepath" "strings" "sync" "testing" @@ -79,6 +80,14 @@ func TestWriteTo(t *testing.T) { _, err := f.WriteTo(bufio.NewWriter(&buf)) assert.EqualError(t, err, ErrWorkbookFileFormat.Error()) } + // Test write with unsupported charset content types. + { + f, buf := NewFile(), bytes.Buffer{} + f.ContentTypes, f.Path = nil, filepath.Join("test", "TestWriteTo.xlsx") + f.Pkg.Store(defaultXMLPathContentTypes, MacintoshCyrillicCharset) + _, err := f.WriteTo(bufio.NewWriter(&buf)) + assert.EqualError(t, err, "XML syntax error on line 1: invalid UTF-8") + } } func TestClose(t *testing.T) { |