From bd5dd17673f767b9f4643423c77eec486f2ad53f Mon Sep 17 00:00:00 2001 From: xuri Date: Sat, 12 Nov 2022 00:02:11 +0800 Subject: This is a breaking change, remove partial internal error log print, throw XML deserialize error - Add error return value for the `GetComments`, `GetDefaultFont` and `SetDefaultFont` functions - Update unit tests --- drawing_test.go | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'drawing_test.go') diff --git a/drawing_test.go b/drawing_test.go index e37b771..5c090eb 100644 --- a/drawing_test.go +++ b/drawing_test.go @@ -15,6 +15,8 @@ import ( "encoding/xml" "sync" "testing" + + "github.com/stretchr/testify/assert" ) func TestDrawingParser(t *testing.T) { @@ -24,12 +26,15 @@ func TestDrawingParser(t *testing.T) { } f.Pkg.Store("charset", MacintoshCyrillicCharset) f.Pkg.Store("wsDr", []byte(xml.Header+``)) - // Test with one cell anchor - f.drawingParser("wsDr") - // Test with unsupported charset - f.drawingParser("charset") - // Test with alternate content + // Test with one cell anchor. + _, _, err := f.drawingParser("wsDr") + assert.NoError(t, err) + // Test with unsupported charset. + _, _, err = f.drawingParser("charset") + assert.EqualError(t, err, "XML syntax error on line 1: invalid UTF-8") + // Test with alternate content. f.Drawings = sync.Map{} f.Pkg.Store("wsDr", []byte(xml.Header+``)) - f.drawingParser("wsDr") + _, _, err = f.drawingParser("wsDr") + assert.NoError(t, err) } -- cgit v1.2.1