diff options
author | xuri <xuri.me@gmail.com> | 2021-12-07 00:26:53 +0800 |
---|---|---|
committer | xuri <xuri.me@gmail.com> | 2021-12-07 00:26:53 +0800 |
commit | 44a13aa402b0189b119635d2f0a26961795c6bda (patch) | |
tree | 0000ed94fe92507517281812ba49d85aa58a7211 /stream_test.go | |
parent | 3325c3946d0ab77083555bab334381a1167ee580 (diff) |
Export 7 errors so users can act differently on different type of errors
Diffstat (limited to 'stream_test.go')
-rw-r--r-- | stream_test.go | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/stream_test.go b/stream_test.go index 52cee4d..833a00a 100644 --- a/stream_test.go +++ b/stream_test.go @@ -174,8 +174,8 @@ func TestStreamTable(t *testing.T) { // Test add table with illegal formatset. assert.EqualError(t, streamWriter.AddTable("B26", "A21", `{x}`), "invalid character 'x' looking for beginning of object key string") // Test add table with illegal cell coordinates. - assert.EqualError(t, streamWriter.AddTable("A", "B1", `{}`), `cannot convert cell "A" to coordinates: invalid cell name "A"`) - assert.EqualError(t, streamWriter.AddTable("A1", "B", `{}`), `cannot convert cell "B" to coordinates: invalid cell name "B"`) + assert.EqualError(t, streamWriter.AddTable("A", "B1", `{}`), newCellNameToCoordinatesError("A", newInvalidCellNameError("A")).Error()) + assert.EqualError(t, streamWriter.AddTable("A1", "B", `{}`), newCellNameToCoordinatesError("B", newInvalidCellNameError("B")).Error()) } func TestStreamMergeCells(t *testing.T) { @@ -184,7 +184,7 @@ func TestStreamMergeCells(t *testing.T) { assert.NoError(t, err) assert.NoError(t, streamWriter.MergeCell("A1", "D1")) // Test merge cells with illegal cell coordinates. - assert.EqualError(t, streamWriter.MergeCell("A", "D1"), `cannot convert cell "A" to coordinates: invalid cell name "A"`) + assert.EqualError(t, streamWriter.MergeCell("A", "D1"), newCellNameToCoordinatesError("A", newInvalidCellNameError("A")).Error()) assert.NoError(t, streamWriter.Flush()) // Save spreadsheet by the given path. assert.NoError(t, file.SaveAs(filepath.Join("test", "TestStreamMergeCells.xlsx"))) @@ -204,7 +204,7 @@ func TestSetRow(t *testing.T) { file := NewFile() streamWriter, err := file.NewStreamWriter("Sheet1") assert.NoError(t, err) - assert.EqualError(t, streamWriter.SetRow("A", []interface{}{}), `cannot convert cell "A" to coordinates: invalid cell name "A"`) + assert.EqualError(t, streamWriter.SetRow("A", []interface{}{}), newCellNameToCoordinatesError("A", newInvalidCellNameError("A")).Error()) } func TestSetCellValFunc(t *testing.T) { |