diff options
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) { |