From a88459d5f1e83006ba421f334a1513d1c231eb6b Mon Sep 17 00:00:00 2001 From: xuri Date: Tue, 16 Apr 2019 10:57:21 +0800 Subject: add unit tests to functions --- adjust_test.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'adjust_test.go') diff --git a/adjust_test.go b/adjust_test.go index a35e609..7b708ab 100644 --- a/adjust_test.go +++ b/adjust_test.go @@ -12,7 +12,7 @@ func TestAdjustMergeCells(t *testing.T) { assert.EqualError(t, f.adjustMergeCells(&xlsxWorksheet{ MergeCells: &xlsxMergeCells{ Cells: []*xlsxMergeCell{ - &xlsxMergeCell{ + { Ref: "A:B1", }, }, @@ -21,7 +21,7 @@ func TestAdjustMergeCells(t *testing.T) { assert.EqualError(t, f.adjustMergeCells(&xlsxWorksheet{ MergeCells: &xlsxMergeCells{ Cells: []*xlsxMergeCell{ - &xlsxMergeCell{ + { Ref: "A1:B", }, }, @@ -50,7 +50,7 @@ func TestAdjustHelper(t *testing.T) { f.Sheet["xl/worksheets/sheet1.xml"] = &xlsxWorksheet{ MergeCells: &xlsxMergeCells{ Cells: []*xlsxMergeCell{ - &xlsxMergeCell{ + { Ref: "A:B1", }, }, @@ -64,4 +64,6 @@ func TestAdjustHelper(t *testing.T) { // testing adjustHelper with illegal cell coordinates. assert.EqualError(t, f.adjustHelper("Sheet1", rows, 0, 0), `cannot convert cell "A" to coordinates: invalid cell name "A"`) assert.EqualError(t, f.adjustHelper("Sheet2", rows, 0, 0), `cannot convert cell "B" to coordinates: invalid cell name "B"`) + // testing adjustHelper on not exists worksheet. + assert.EqualError(t, f.adjustHelper("SheetN", rows, 0, 0), "sheet SheetN is not exist") } -- cgit v1.2.1