From 40ff5dc1a7d7aa42f5db9cf9dfe858cc3820b44e Mon Sep 17 00:00:00 2001
From: xuri <xuri.me@gmail.com>
Date: Sat, 23 Mar 2019 20:08:06 +0800
Subject: refactor: handler error instead of panic,

Exported functions:

SetCellStyle
InsertCol
RemoveCol
RemoveRow
InsertRow
DuplicateRow
DuplicateRowTo
SetRowHeight
GetRowHeight
GetCellValue
GetCellFormula
GetCellHyperLink
SetCellHyperLink
SetCellInt
SetCellBool
SetCellFloat
SetCellStr
SetCellDefault
GetCellStyle
SetCellValue
MergeCell
SetSheetRow
SetRowVisible
GetRowVisible
SetRowOutlineLevel
GetRowOutlineLevel
GetRows
Columns
SearchSheet
AddTable
GetPicture
AutoFilter
GetColVisible
SetColVisible
GetColOutlineLevel
SetColOutlineLevel
SetColWidth
GetColWidth

inner functions:

adjustHelper
adjustMergeCells
adjustAutoFilter
prepareCell
setDefaultTimeStyle
timeToExcelTime
addDrawingChart
addDrawingVML
addDrawingPicture
getTotalRowsCols
checkRow
addDrawingShape
addTable
---
 date_test.go | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

(limited to 'date_test.go')

diff --git a/date_test.go b/date_test.go
index 3ec0b69..63cb19e 100644
--- a/date_test.go
+++ b/date_test.go
@@ -31,7 +31,9 @@ var trueExpectedDateList = []dateTest{
 func TestTimeToExcelTime(t *testing.T) {
 	for i, test := range trueExpectedDateList {
 		t.Run(fmt.Sprintf("TestData%d", i+1), func(t *testing.T) {
-			assert.Equalf(t, test.ExcelValue, timeToExcelTime(test.GoValue),
+			excelTime, err := timeToExcelTime(test.GoValue)
+			assert.NoError(t, err)
+			assert.Equalf(t, test.ExcelValue, excelTime,
 				"Time: %s", test.GoValue.String())
 		})
 	}
@@ -44,9 +46,8 @@ func TestTimeToExcelTime_Timezone(t *testing.T) {
 	}
 	for i, test := range trueExpectedDateList {
 		t.Run(fmt.Sprintf("TestData%d", i+1), func(t *testing.T) {
-			assert.Panics(t, func() {
-				timeToExcelTime(test.GoValue.In(location))
-			}, "Time: %s", test.GoValue.String())
+			_, err := timeToExcelTime(test.GoValue.In(location))
+			assert.EqualError(t, err, "only UTC time expected")
 		})
 	}
 }
-- 
cgit v1.2.1