summaryrefslogtreecommitdiff
path: root/date_test.go
diff options
context:
space:
mode:
authorxuri <xuri.me@gmail.com>2019-03-23 20:08:06 +0800
committerxuri <xuri.me@gmail.com>2019-03-23 20:08:06 +0800
commit40ff5dc1a7d7aa42f5db9cf9dfe858cc3820b44e (patch)
tree9683b0a18a08f6603065506589a3c86dba5b8bb1 /date_test.go
parent2874d75555102b8266477cdda2966ff37dde6b12 (diff)
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
Diffstat (limited to 'date_test.go')
-rw-r--r--date_test.go9
1 files changed, 5 insertions, 4 deletions
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")
})
}
}