diff options
author | xuri <xuri.me@gmail.com> | 2019-04-16 10:57:21 +0800 |
---|---|---|
committer | xuri <xuri.me@gmail.com> | 2019-04-16 10:57:21 +0800 |
commit | a88459d5f1e83006ba421f334a1513d1c231eb6b (patch) | |
tree | 49322fadda8f3024c6b5a3ea63e3326351224836 /adjust_test.go | |
parent | f2df344739146189a1dea7cfb81239231af5135b (diff) |
add unit tests to functions
Diffstat (limited to 'adjust_test.go')
-rw-r--r-- | adjust_test.go | 8 |
1 files changed, 5 insertions, 3 deletions
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") } |